Subject | RE: [firebird-support] Insert and Generators |
---|---|
Author | Alan McDonald |
Post date | 2005-09-14T09:36:34Z |
>$newaccountid = $db->get_var("SELECT GEN_ID(GEN_ACCOUNT,1) FROM
> I am using an oninsert trigger and generator to provide the primary key
> for a table. After inserting the record, I want to use the value of the
> primary key just generated to insert some detail records related to the
> master record I have just created. How do I return to my php program
> the value of the primary key? I am using an insert statement in the php
> script at the moment to inert the data for both tables.
>
>
RDB\$DATABASE");
(or equivalent) will get the new value. Use it in your insert statement and
in the subsequent detail records FK. Ensure your trigger tests for NULL and
does not get a new gen value when it's being given one already.
Alan