List:General Discussion« Previous MessageNext Message »
From:mel list_php Date:February 15 2005 12:57pm
Subject:Re: last_insert_id
View as plain text  
I just would ask for a precision:
In my system, I include a connection file with my parameters 
(host,user,pass).This is the details of the account allowed to establish the 
connection with the mysql server.
When 2 users are connecting to the database (through the web), they will use 
the same details (host,user,pass) for the connection.
Does that mean that they are sharing the same mysql connection (and in that 
case will I need a lock?) or are they each of them opening their own 
connection?
Can I check that somewhere?
Thanks a lot.



>From: Philippe Poelvoorde <philippe@stripped>
>Reply-To: "'mysql@stripped '" <mysql@stripped>
>To: mel list_php <list_php@stripped>
>CC: mysql@stripped
>Subject: Re: last_insert_id
>Date: Tue, 15 Feb 2005 10:50:40 +0000
>
>mel list_php wrote:
>>Hi!
>>
>>I have a database where several users can connect and input data.
>>
>>I managed to have my insert queries as atomic, but I was wondering about 
>>one special case: I make one insert, and retrieve the last id inserted by 
>>mysql because I need to update an other table with that id.
>>
>>- if one user inserts and retrieves the id, but between both one other has 
>>inserted something the id returned will be the right one?
>
>Last_insert_id() is consistent on a per-connection basis, meaning you don't 
>need to use lock (hopefullly !)
>http://dev.mysql.com/doc/mysql/en/getting-unique-id.html
>
>btw, what do you mean by : "I managed to have my insert queries as atomic". 
>Because if you do : INSERT .... it's already suppose to be atomic.
>
>HIMH.
>
>--
>Philippe Poelvoorde
>COS Trading Ltd.

_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger 
http://www.msn.co.uk/messenger

Thread
last_insert_idmel list_php15 Feb
  • Re: last_insert_idJohan Höök15 Feb
  • Re: last_insert_idAlec.Cawley15 Feb
  • Re: last_insert_idPhilippe Poelvoorde15 Feb
    • Re: last_insert_idmel list_php15 Feb
    • Re: last_insert_idmel list_php15 Feb
    • Re: last_insert_idmel list_php15 Feb