[drupal-devel] LOCK vs. SELECT FOR UPDATE

Karoly Negyesi karoly at negyesi.net
Thu Sep 29 11:44:29 UTC 2005


On Thu, 29 Sep 2005 13:39:03 +0200, Moshe Weitzman <weitzman at tejasa.com>  
wrote:

> Karoly Negyesi wrote:
>>>> I think that I do now recall why we are looking up the next ID first:  
>>>> If
>>>> we use mysql_insert_id we risk not getting the right ID.
>>   Per mysql doc:
>>  "For LAST_INSERT_ID(), the most recently generated ID is maintained in  
>> the  server on a per-connection basis. It is not changed by another  
>> client."
>>  I fail to see how could we no get the right ID.
>
>
> Do successive requests from the same web server reuse the same  
> connection?

End of PHP script closes connection. If you have the knowledge to change  
DB layer to use pconnect then you certainly can (re)introduce LOCKing.



More information about the drupal-devel mailing list