On Fri, 20 Jun 2003, Luis Campos de Carvalho wrote:

>    AFAIK, this is the safest method of updating the same table using 
> different processes. The sequence never offers the same value for two 
> different requests, even when they're parallel.

Unless you have multiple servers accepting inserts to the same database 
with a unique record id (a terrible idea, I know) parallel isn't a problem 
as the database should handle that (MySQL certainly does).

> > With the MySQL insert_id method you get the result of a completed 
> > insertion so you know for certain what it is.
> 
>    MySQL don't implement transactions.

Yes it does. As others keep pointing out it's just a matter of table type 
with current version of MySQL.

>    When you "commit" your transaction, you're sure that everything is 
> fine. And then you could get the current value from the sequence using
> 
>    SELECT sequence_name.currval (...)
> 
>    or something like this. I don't remember exactly the attribute name, 
> please take a look at your manual.

I know it just seems an expensive way of doing it.

Jason Clifford
-- 
UKFSN.ORG               Finance Free Software while you surf the 'net
http://www.ukfsn.org/                   Sign up now


Reply via email to