Re: nextID
| From: | Tomas V.V.Cox | Date: | Mon, 25 Jun 2001 12:46:59 +0000 |
| Subject: | Re: nextID | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-172@lists.php.net to get a copy of this message | ||
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