> A programmer just asked me about a possible race condition,
> and I didn't know what to answer:
> If I insert a line using autoincrement, then ask for last_insert_id()
> am I guaranteed to get the same ID I just inserted?
Yes
> It seems that another program could be inserting at almost the same
> time, and could increment the counter again before my last_insert_id()
> checks it. In that case, I would not be dealing with the
> same line I just inserted.
last_insert_id is stored on a per-connection basis, and frecords the
last insert done by that connection
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]