Subject Re: [firebird-support] Re: Correct Way?
Author Helen Borrie
At 03:41 AM 27/10/2004 +0000, you wrote:


>Hi
>--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
>wrote:
>
> > Yes: get the generator value BEFORE it is to be used. Generators
>execute
> > outside of all transaction contexts and a value can not be generated
> > twice. Depending on how your application interface works, you can
>do this
> > one of two ways, both simple:
>
>I am curious.
>
>In a multi user environment where a generator generates a two or more
>values (for two or more separate transactions), if a prior value is
>rolled back, leaving a later value in use in the table (thinking along
>the lines of value 1, 2, 3 etc). Would (could?) the genrerator reuse
>ie regenerate a now missing ie unused value.
>
>For example...
>
>user 1 begins a transaction and is issued value 101 by the generator.
>user 2 begins a transaction and is issued value 102 by the generator.
>user 3 begins a transaction and is issued value 103 by the generator.
>
>If user 3 commits value 103, then user 1 rolls back the transaction
>effectively not using value 101, would the generator "know" that it
>can use value 101 and use it before generating value 104?, or does all
>of this only operate on an incremental basis?
>
>Perhaps this is dependant on user needs?

Nope. As I said, generators generate right outside ALL transaction
contexts. Once a value is generated it can't be generated again. It's not
related to any transaction context that requested it. Generator numbers
are not "recycled" by the engine.

Unless, of course, you do something really stoopid, like running SET
GENERATOR.

./hb