> Thanks, but how secure is this. Is it possible for two computers to do
> the "select" at the same time, i.e. get the new incremented value?
> Computer one insert, computer two insert, computer one select, computer
> two select?
> 
> If this is possible how can I solve this? To make the column that insert
> the new nextval unique and then check for errors (non-unique insert) and
> if error then re-ask for a new nextval? Is this the best solution?
> 

It's not possible to mix up the values. The value returned 
last_insert_id() is conncection specific, so each computer 
will receive only the value that it generated.

/ Carsten
--
Carsten H. Pedersen
keeper and maintainer of the bitbybit.dk MySQL FAQ
http://www.bitbybit.dk/mysqlfaq

> Thanks / Henrik
> 
> ---
> 
> create table MySequence ( nextval  int(10) not null default '0'
> auto_increment ) ;
> 
> insert into MySequence values ('');
> select LAST_INSERT_ID();
> 
> is what I use....
> 
> M
> 
> -----Original Message-----
> From: Henrik Erlandsson [mailto:[EMAIL PROTECTED]]
> Sent: 13 December 2001 15:41
> To: [EMAIL PROTECTED]
> Subject: sequence and nextval
> 
> 
> Does the above functions exist in MySQL? If not, when do you think it's
> going to be implemented and how can I simulate nextval the easiest way?
> 
> / Thanks Henrik


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