Subject RE: [firebird-support] Generator Question
Author Svein Erling Tysvær
>I have a customer that reports from time to time that my application is
>issuing the same Order Number. The order number's source is a generator.
>
>My application (using a very old version of IBO):
>
>1) Creates a Transaction object in code. (default AutoCommit is False)
>2) Creates a cursor object in code and assigns the above transaction.
>3) The cursor component calls a stored procedure which calls gen_id:
>EndOrderNo = gen_id(gen_orderno, :InOrderCount);
>
>4) The Transaction component's "Commit" method never gets called. This
>is probably my error however I thought generator calls/increments are
>outside of the transaction.
>
>Can someone confirm the errors of my ways? Thanks in advance!

Two weeks ago there were some discussion under the title "Generator not incrementing" at the ibobjects list (the discussion started earlier, but the most interesting emails are probably from 16 November and later). Basically, I think there were at least two different reasons identified for generators not incrementing (though I haven't been bitten by this issue, so I've not read thoroughly):

1) A Firebird bug fixed in version 1.5.1
2) The Firebird server (or fbembed) crashing (without commit)

The solution for 1) would be to upgrade the Firebird version and 2) would only matter if the generated numbers were used outside the database. I think Jason ended up proposing a new parameter that would make it possible to ascertain generators increasing even if crashes occurred (though it would slow things down, so it wasn't done by default).

HTH,
Set