Re: nextID
| From: | Jeff Stuart | Date: | Sun, 08 Jul 2001 23:21:18 +0000 |
| Subject: | Re: nextID | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-187@lists.php.net to get a copy of this message | ||
Ok... question... I know that Sebastian (I think it was you. :D) said that
Pear won't support mysql's auto increment feature. Does this mean that Pear
won't work with a table that has an auto increment feature? Or that you
won't use it to generate the sequences? Assuming the latter, can I use
mysql_insert_id with Pear::DB to get the last inserted id? Also, can we use
some of the other mysql functions with Pear::DB? IE is there a way for us
to get access to Pear::DB's internal variable that holds the resource link
id?
--
Jeff Stuart
jstuart@neo.rr.com
"Tomas V.V.Cox" <cox@idecnet.com> wrote in message
news:3B3732C3.478078B8@idecnet.com...
> John Fitzpatrick wrote:
> >
> > How does PEAR's implementation of an auto-increment feature fare in
terms of
> > concurrency?
> >
> > I would have thought that abstracting this type of functionality away
from
> > the DBMS might lead to concurrency problems when more than one user
> > simultaneously tries to perform an INSERT to the same table.
> >
>
> We use "sequences" (or emulated sequences in some extensions like MySQL)
> for that. First you request a true uniq ID to the sequence and then
> insert the returned value in the ID field of the new row. There isn't
> concurrency problems. This is covered in the tutorial:
>
> http://vulcanonet.com/soft/pear_tut/
>
> Tomas V.V.Cox