Re: Re: deprecated mysql funcs

From: Date: Tue, 06 Jan 2004 17:23:12 +0000
Subject: Re: Re: deprecated mysql funcs
References: 1 2 3 4  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969357991@lists.php.net to get a copy of this message
At 16:06 +0100 1/5/04, Jakub Vrana wrote:
Gabor Hojtsy wrote:
Read the docs of the function, it is not the same. The function is supposed to return the ID *you have inserted* in this session, while the SELECT return the ID last *inserted by someone*, maybe paralelly to your session.
That is incorrect. Neither of them may be used to obtain the value inserted by some other connection. If they did, they would be useless.
MySQL LAST_INSERT_ID() documentation says: "The last ID that was generated is maintained in the server on a per-connection basis. This means the value the function returns to a given client is the most recent AUTO_INCREMENT value generated by that client. The value cannot be affected by other clients, even if they generate AUTO_INCREMENT values of their own." Thus it should be the same. Anyway, I am against making this function obsolete.
That is also incorrect. They are not precisely the same.
Jakub Vrana


« previous php.doc (#969357991) next »