Book a Demo

Author Topic: Interbase/Firebird Autoincrement Generator/Trigger  (Read 5452 times)

JLove

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Interbase/Firebird Autoincrement Generator/Trigger
« on: December 23, 2004, 03:02:18 pm »
The Data Modeling generated SQL DDL for an Interbase/Firebird database with an Autoincrement Field in a Table does not correctly implement support for a Generator and corresponding Trigger.

Using the "Drop Table" checkbox to generate the SQL DDL creates a line in the SQL:

DELETE FROM RDB$GENERATORS WHERE RDB$GENERATOR_NAME='TableName_FieldName_INC';

However, the Generator (and corresponding Trigger) is not created in the script.  The create SQL DDL should be something like this:

CREATE GENERATOR "TableName_FieldName_INC";
SET GENERATOR "TableName_FieldName_INC" TO 0
;

SET TERM ^ ;

CREATE TRIGGER "TRG_TableName_FieldName" FOR "Activity"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
 IF (NEW."FieldName" IS NULL) THEN
   NEW."FieldName" = GEN_ID("TableName_FieldName_INC",1);
END
^

SET TERM ; ^
« Last Edit: December 23, 2004, 03:07:33 pm by JLove »
James Love
Software Engineer
SenDx Medical, Inc.
A Division of Radiometer Copenhagen

hd

  • EA Administrator
  • EA User
  • *****
  • Posts: 312
  • Karma: +0/-0
    • View Profile
Re: Interbase/Firebird Autoincrement Generator/Tri
« Reply #1 on: December 23, 2004, 05:18:37 pm »
Thanks for your note - we'll look in to that.

mikewhit

  • EA User
  • **
  • Posts: 608
  • Karma: +0/-0
  • Accessing ....
    • View Profile
NEWS?- Interbase/Firebird Autoincrement Generator
« Reply #2 on: January 24, 2005, 02:35:08 am »
News please, Sparx !

We are currently working around a number of issues regarding procedures and triggers on InterBase, which were reported in detail by a colleague in September, via email.

If this is still an issue in build 744 then it would be good to have an idea when the fix might become available.

Thanks.