Subject Re: [firebird-support] Auto-Increment and Rollback
Author Miroslav Penchev
On Wed, 27 Oct 2004 09:58:45 -0200, Gerson Machado - Yahoo
<gersonamach@...> wrote:

> If I have a application in Delphi (version 7 with IBX 7.08) and execute
> a Insert command (in a IBQuery in Delphi) but I change my mind and
> Rollback the transactions, why the field (with generator to
> auto-increment) in the table was add by 1, if my record was not write ?
> What I need to do to can not add 1 when transations was rollbacked ?
> I try to use IBObjects and happened the same thing.

I am wondering why this question is not answered so long....
Generators are not incremented inside your transaction (actually they work
outside any transaction) and therefore you cannot rollback changes to
generator value. That is the main idea of generators - to give you a
unique value every time you need it and because of this - changes to
generator value cannot belong to any transaction.

There is a statement to SET value of generator, but it is used in some
rare cases.

Miroslav Penchev