Subject Re: [firebird-support] Transaction Problem
Author Carlos H. Cantu
AWH> There may be a problem with your database design. Yes, two
AWH> transactions can generate invoices at the same time without
AWH> conflicting, but two transactions cannot change the same
AWH> record at the same time. So, if you have a table you use to
AWH> generate invoice numbers by reading the value of a field and
AWH> incrementing it, you will have conflicts. Firebird has generators
AWH> (also called sequences) that supply unique values; they're
AWH> faster than keeping a counter in the database and they don't
AWH> cause deadlocks.

Major problem is that usually invoice sequence can't be broken, and as
generators are outside the transaction control, it can happen that a
"invoice" transaction be rolled back when the generator was already
incremented, what would result in a broken sequence.

In the IBO site, there is a paper that comments some solutions to the
problem:

http://www.ibobjects.com/docs/ti_AuditableSeries.ZIP

Carlos
Firebird Performance in Detail - http://videos.firebirddevelopersday.com
www.firebirdnews.org - www.FireBase.com.br