Subject Re: SV: [IBO] Refrasing my question about TIBOTable (prettyprinted)
Author Thomas Steinmaurer
> Hi - you are right, the generator AddressNo_ADDRESS_GEN is called twice, once because of the GeneratorLinks, and once by the trigger AddressNo_ADDRESS_TRIG.
>
> Now I'm wondering, is the alternative trigger below the right way to do it? Is this the way create a new record in a table and knowing the value of the automatically generator primary key?

I see the following ways for the client application to "know" a primary
key value feed by a generator:

- Call TIB_Connection.GEN_ID(<generator_name>, 1) and use that

- Get the next generator value at client side via a mechanism like the
GeneratorLinks property (which will call GEN_ID anyway *g*) and make
sure that the primary key value doesn't get incremented in a BEFORE
INSERT trigger twice

- Use the RETURNING keyword of an INSERT INTO statement to transfer a
server-side generated value to the client. Can't recall if IBO exposes
this via property or similar.


--
With regards,

Thomas Steinmaurer
Upscene Productions
http://www.upscene.com
http://blog.upscene.com/thomas/

Download LogManager Series, FB TraceManager today!
Continuous Database Monitoring Solutions supporting
Firebird, InterBase, Advantage Database, MS SQL Server
and NexusDB!