Subject | Re: [firebird-support] Re: Last insert id ? |
---|---|
Author | Velja Radenkovic |
Post date | 2006-03-11T11:50:51Z |
Hello,
Thank you. I got the point. I'll implement it on Monday.
Velja
On 3/11/06, Svein Erling Tysvær <svein.erling.tysvaer@...>
wrote:
Thank you. I got the point. I'll implement it on Monday.
Velja
On 3/11/06, Svein Erling Tysvær <svein.erling.tysvaer@...>
wrote:
>[Non-text portions of this message have been removed]
> Concurrency is the reason generators are outside transaction control.
>
> Here's my 'plain English' translation of a few gen_id calls:
>
> 'select gen_id(generator_name, 1) from rdb$database;'
> Get me one number that I can use like I please.
>
> 'select gen_id(generator_name, 0) from rdb$database;'
> Get me the last given generator value. I promise I won't use it for
> inserting anything, I'm just curious about the current state.
>
> 'select gen_id(generator_name, 10) from rdb$database;'
> Get me one number that I can use like I please, and I want to be able
> to use the next 9 numbers as I please as well.
>
> (this latter one can also be used if you e.g. have 10 branches and
> want unique numbers throughout the organisation. By having different
> starting points, you could make it so that every number ending on 1
> came from one particular branch, 2 for another etc.)
>
> It is up to your programs to ascertain that you do not break the above
> rules. And never expect two subsequent calls to a generator to contain
> two consecutive numbers - as you said, another process may do
> something in between.
>
> HTH,
> Set
>