Hi,

On Wed, Mar 26, 2003 at 03:17:42PM +0100, Steve Rapaport 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. The last inserted id is kept per connection. So unless YOU insert
another record using the same connection, the last_insert_id isn't
changed. Also, last_insert_id in a new connection will give you NULL,
regardless of what you did in a previous connection.


Regards,

Fred.

-- 
Fred van Engen                              XB Networks B.V.
email: [EMAIL PROTECTED]                Televisieweg 2
tel: +31 36 5462400                         1322 AC  Almere
fax: +31 36 5462424                         The Netherlands

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

Reply via email to