Subject | Re: [ib-support] Interbase Transactions |
---|---|
Author | Helen Borrie |
Post date | 2000-12-14T22:50:28Z |
At 08:38 PM 14-12-00 +0000, you wrote:
generators are not hooked up to the columns they populate.
Here is an example:
SET TERM ^ ;
CREATE TRIGGER BI_NEW_KEY FOR ATABLE
ACTIVE BEFORE INSERT POSITION 0 AS
BEGIN
IF ((NEW.IDFIELD IS NULL) OR (NEW.IDFIELD=0)) THEN
NEW.IDFIELD = GEN_ID(THEGENERATOR, 1);
END ^
SET TERM; ^
Helen
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>Hello:You need to add a trigger to the table to fire the generator, because
>Having a bit of a problem with IB6 transactions. Using Delphi 5.
>Have an application I am converting from D5/Paradox to D5/IB6.
>Table has AUTOINC field for its key. When user posts new record, new
>key is generated with AUTOINC field. I then use this key to add
>records in other tables that are connected to this table
>Master/Deatil. This works fine in Paradox. Set up IB6 table and
>created AUTOINC field with generator and trigger. This works fine,
>everytime I call table.post, new record with incrementing key is
>added. However, when new records are added the AUTOINC field is not
>visible until I close the table. Therefore, key field is 0 so I
>can't add records to other tables. Assume this has something to do
>with transactions. Have tried CommitRetaing when I post but this
>does not help. If I call table.refresh, this works but resets table
>to 1st record. Can someone tell me what I need to do.
generators are not hooked up to the columns they populate.
Here is an example:
SET TERM ^ ;
CREATE TRIGGER BI_NEW_KEY FOR ATABLE
ACTIVE BEFORE INSERT POSITION 0 AS
BEGIN
IF ((NEW.IDFIELD IS NULL) OR (NEW.IDFIELD=0)) THEN
NEW.IDFIELD = GEN_ID(THEGENERATOR, 1);
END ^
SET TERM; ^
Helen
>Thanks GenoAll for Open and Open for All
>
>
>
>
>To unsubscribe from this group, send an email to:
>ib-support-unsubscribe@egroups.com
>
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________