Connecting Tech Pros Worldwide Forums | Help | Site Map

What is considered 'multiple clients' - LAST_INSERT_ID().

Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,949
#1: Sep 4 '09
The MySQL manual states:

Quote:
Using LAST_INSERT_ID() and AUTO_INCREMENT columns simultaneously from multiple clients is perfectly valid. Each client will receive the last inserted ID for the last statement that client executed.
I wonder what is considered a 'client'. Is that simply just different connections to the database?

dlite922's Avatar
Expert
 
Join Date: Dec 2007
Location: Moon, Dark Side
Posts: 1,095
#2: Sep 4 '09

re: What is considered 'multiple clients' - LAST_INSERT_ID().


Well don't know but it seems to work, so IMHO it's same to assume that's what a client means.

If it wasn't true if two people were using the app and both say...new users. the first user wouldn't get the first user's auto_increment ID.


Dan
mwasif's Avatar
Moderator
 
Join Date: Jul 2006
Location: Pakistan
Posts: 719
#3: Sep 4 '09

re: What is considered 'multiple clients' - LAST_INSERT_ID().


Quote:

Originally Posted by Markus View Post

The MySQL manual states:
I wonder what is considered a 'client'. Is that simply just different connections to the database?

Yes, each connection to MySQL will be considered a separate client.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,949
#4: Sep 4 '09

re: What is considered 'multiple clients' - LAST_INSERT_ID().


Quote:

Originally Posted by mwasif View Post

Yes, each connection to MySQL will be considered a separate client.

Thanks for the clarification!
dlite922's Avatar
Expert
 
Join Date: Dec 2007
Location: Moon, Dark Side
Posts: 1,095
#5: Sep 4 '09

re: What is considered 'multiple clients' - LAST_INSERT_ID().


That's what I just said! :)

j/k



Dan
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,949
#6: Sep 5 '09

re: What is considered 'multiple clients' - LAST_INSERT_ID().


Quote:

Originally Posted by dlite922 View Post

That's what I just said! :)

j/k



Dan

I was thanking both of you, I just couldn't reply to you both (without more clicking).

;D
Reply