Subject RE: [firebird-support] Re: Generators, revisited
Author Kevin Stanton
And thanks to all that replied! As Helen mentioned, there must be some
nasty code creating the situation.
As it turns out, thanks to copy/paste, the wrong <number of records>
variable was being passed into the function (was always zero in this case)
so the generator was never being incremented.
I'm just extremely happy it was me (which I suspected) - not the database.
Thanks again.

-----Original Message-----
From: Svein Erling Tysvær [mailto:svein.erling.tysvaer@...]
Sent: Monday, September 13, 2004 2:01 AM
Subject: [firebird-support] Re: Generators, revisited

Hi Kevin!

So you are doing a GEN_ID(<generator>, <number of records>) and then
use the numbers from the returned value and <number of records> - 1
forward? Well, this should be safe, except for the following cases:

* <number of records> is a negative number or 0.
* you use a number higher than <generated value> + <number of records>
- 1 records.
* you use the same value twice

Of course, you do have the standard reasons for trouble as well, i.e.
someone using a number without calling the generator or using SET
GENERATOR to decrease the value.

Could any of these be applicable to your case?


--- In, Kevin Stanton wrote:
> Thanks Helen, I'm in the hunt for the evil code and I've also
> downloaded the demo app from IBO that you mentioned in your book
> (thank you for the book!).
> The only reason why I'm getting the generator value via a query is
> each user wants to have sequential numbers for their own batch of
> invoices. So I go and retrieve x number of invoices, thus the step
> in retrieving the generator value.
> Kevin

Yahoo! Groups Sponsor

Yahoo! Groups Links

a.. To visit your group on the web, go to:

b.. To unsubscribe from this group, send an email to:

c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

[Non-text portions of this message have been removed]