Subject Re: [firebird-support] GEN_ID Trigger
Author Dimitry Sibiryakov
On 9 Oct 2003 at 10:17, Oliphant, Dion wrote:

>I am using ADO components to connect to a Firebird database. I have created
>a trigger to genrerate a unique id for a table. When appending a record to
>the table using IBOConsole, the new id value is not inserted into the
>relevant field, ie the trigger is not 'triggered'. It is active. Is this

Yes. I bet that value _is_ inserted into field but you don't see it
because FB doesn't have any mechanism to let a client application to
know this auto-assigned value.
Usual pattern to work with FB-type autoincrement is:
1) get a new value to client by using 'select
gen_id(your_generator,1) from RDB$DATABASE';
2) insert record, using received value.
Trigger is mostly used for non-interactive inserts, when nobody
cares about ids.

IBX implements this pattern internally. May be ADO/driver has some
combination of settings which allows to do the same. If not,
OnNewRecord is very suitable place to get a new id and to assign it
to the field.

SY, Dimitry Sibiryakov.