Subject Re: [firebird-support] Feature request : Generator tables
Author Martijn Tonies
Hi,

> >>Generators are nice. The main thing that's good about them is that
> >>they're transaction independant. Thus, they are perfect for generating a
> >>sequence of consecutive interger values.
> >>
> >>
> >If by "consecutive sequence" you mean a series of numbers with no spaces
> >(missing numbers) in-between then you can *not* use a generator. Because
> >-as you said- "they're transaction independant":

I remember when we had to solve such a thing once (in Oracle,
with Sequences).

What we did, is to have an internal PK value (by a generator),
insert the new records and once everything was inserted (saved)
to the database and the transaction was committed (as in: no
faults), we then did:

UPDATE <table>
SET UserVisibleColumn = GEN_ID(mygenerator, 1);

(actually, the Oracle equivalent, but you get the idea).

I don't think we ever missed a number.

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com