Re: DB::nextId() question
| From: | Donghui Wen | Date: | Thu, 14 Nov 2002 19:06:07 +0000 |
| Subject: | Re: DB::nextId() question | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-2726@lists.php.net to get a copy of this message | ||
DB::nextID() return the free next ID. For Mysql, when first time call
this function, it will create a sequence table, and get the id from
that table. For postgresql, it will create a sequence and return
the next id. In both case, it will increase the sequence.
Donghui
> Hallo,
>
> how does/should the DB::nextID() work? Does it return the free next ID
> of the sequence AND increase the sequence, or does it just return the ID?
>
> The latter case seems illogical, as two users could have the same ID,
> and simultaneously assume it is free, but only one would really have it
> free.
>
> Whereas with the first case, when the ID is returned, it stays free for
> ever, and the user can without problems execute
>
> INSERT INTO ... (ID,...) values (lastID,...).
>
> The documentation is not clear about that - it says "returns next free
> ID",
> but is this really guaranteed?
>
> Thank you for your answer!
>
> Drago
>
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>