Welcome Guest, Not a member yet? Register   Sign In
Help: ActiveRecord and nextID
#1

[eluser]Mel [RS][/eluser]
Hi guys i've a problem and i need some inspiration to solve this.

I've an app and this works with mysql v4.x . Now I'm creating a new version with CI but this app don't use auto_increment fields 'cause i've to replicate that databases to another db servers to accurate uptime.

So, actuallly I use PEAR DB class and the nextID method. I readed the CI docs and I didn't found this method.

Anybody can help me to any way to afront this? I say, i'm using now CI and i need to use active record class, just i need the nextid method.

Please some orientation will be greatefull.

Cheers.
#2

[eluser]sl3dg3hamm3r[/eluser]
Welcome to Codeigniter!

I'm not sure if this points into the right direction, but you can extend core-classes yourself. Which would mean you would extend the DB-class with a method which would return the next Id of a given table. How to extend core-classes, have a look here.
#3

[eluser]xwero[/eluser]
Am i right to think the nextId method is basically a max(field) from table sql statement that knows the format of the field to increment?
#4

[eluser]Mel [RS][/eluser]
Thanks to both for your replies.

Now I'm looking for a way to extend the CI DB-class and to add the nextID method. For sure I've sorpriselly assigned to me this project so I've not studied it very much.

And yes Research Associate, I think the nextID method is just that, thanks. Now I'm not really sure about what file is but, I'll search it.

Cheers.




Theme © iAndrew 2016 - Forum software by © MyBB