Subject | Re: [ib-support] Porting from mysql to firebird |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2003-02-21T12:55:42Z |
We've got generators, which are outside transaction control. Used correctly
(i.e. by calling GEN_ID(<generatorname>, 1) every time you want a new
number) these guarantee unique numbers. However, since they are outside
transaction control, you have to first grab the number using GEN_ID and
then insert it into whatever field you want. Using something like
GEN_ID(<generatorname>, 0) I assume is similar to last_insert_id(), but
this isn't safe in a multiuser environment where two people can insert
simultaneously.
There exists no column type AUTO_INCREMENT, most of us use INTEGER and
fills them using generators.
HTH,
Set
At 13:27 21.02.2003 +0100, you wrote:
(i.e. by calling GEN_ID(<generatorname>, 1) every time you want a new
number) these guarantee unique numbers. However, since they are outside
transaction control, you have to first grab the number using GEN_ID and
then insert it into whatever field you want. Using something like
GEN_ID(<generatorname>, 0) I assume is similar to last_insert_id(), but
this isn't safe in a multiuser environment where two people can insert
simultaneously.
There exists no column type AUTO_INCREMENT, most of us use INTEGER and
fills them using generators.
HTH,
Set
At 13:27 21.02.2003 +0100, you wrote:
>Hello
>
>I'm about to port my application from using mysql to firebird.
>Although Im going to do some testing first. In mysql there are a sql
>function called last_insert_id() the returns the last inserted primary
>key (if the column got the type AUTO_INCREMENT).
>
>Are there a similiar function in firebird? That is, auto_increment and
>last_insert_id()?
>
>Thanks,
> Jonas