30.01.02 17:48:06, Richard Bolen <[EMAIL PROTECTED]> wrote:

>
>I think AUTO_INCREMENT is on a per-connection basis.  So if you're doing
>this across different database connections, it will reset to 0.

no, that's not the case.
just try it.
crate a table with column id as auto_increment int and a column test as int;
do an 'insert into <tablename> values( NULL, 1)' from two different clients, 
do a 'select * from <tablename> where test=1' and you will see that the 2 new 
values will be visible to both of the clients.

I don't yet fully understand what the manual tries to tell, but the increment works 
fine also after disconnecting/reconnecting a client or restarting the database.

the only special thing to recognize is with function last_insert_id().
if one client creates a new autoincrement value, the other client can't see this, 
the result for 'select last_insert_id()' is 0!
only the client performing the increment is able to determine the new value valid 
for _this_ client.
imagine that both clients did their increments on the same table, last_insert_id() 
gives 
different answers to both of them.
on the other hand: 'select max(id)' gives the absolute maximum to both of the clients.


Andreas

MySQL



---------------------------------------------------------------------
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