On Wednesday 26 March 2003 08:25, you wrote:
> > 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

so, if your using a connection pooling system then a race condition can 
happen, but its only due to the connections being shared.

anyone happen to know if coldfusion's use of odbc locks the connection per 
page request or does it just do it on queries and unlocks it as soon as the 
query is done?

--
sql sql sql mysql

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to