On Tue, Jan 16, 2001 at 07:07:25PM -0600, Scott Gerhardt wrote:

> I was reading the information on foreign keys in the manual
> http://www.mysql.com/doc/e/x/example-Foreign_keys.html and noticed
> that there is no mention of locking the tables.
> 
> It seems to me that using the example verbatim could lead to loss of
> referencial integrity if INSERTS did not occur in sequence
> (i.e. another person was inserted before shirts).
> 
> Using "LAST_INSERT_ID()" can only be guranteed to work if the tables
> are locked.
> 
> Am I correct or did I miss something?

You're missing the fact that LAST_INSERT_ID()'s value is on a
per-clent basis. So it's the last ID *you* inserted. If others are
making inserts at the same time, it won't affect your values of
LAST_INSERT_ID().

Jeremy
-- 
Jeremy D. Zawodny, <[EMAIL PROTECTED]>
Technical Yahoo - Yahoo Finance
Desk: (408) 328-7878    Fax: (408) 530-5454
Cell: (408) 439-9951

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to