If running mod_perl does this stay true??? Isn't mod_perl using an already opened connection to do subsequent manipulations?
Or when one perl script is using a connection is creates a new connection for each perl script that starts running and if a perl script finishes, it keeps that same db handle for the next perl script asking a connection? If this is the case than I magine last_insert_id will always return the good value.. sorry if this is mod_perl related Etienne "Carsten H. Pedersen" wrote: > > > 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 -- Etienne Marcotte Specifications Management - Quality Control Imperial Tobacco Ltd. - Montreal (Qc) Canada 514.932.6161 x.4001 --------------------------------------------------------------------- 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