

COMMIT;

CREATE TABLE DOWNLOAD (
  DL_ID INT NOT NULL,
  DL_DOWNLOADFILES_FK INT NOT NULL,
  DL_TIMESTAMP TIMESTAMP NOT null,
  DL_IP VARCHAR(15) NOT NULL,
  CONSTRAINT PK_DOWNLOAD PRIMARY KEY (DL_ID)
);

COMMIT;

CREATE GENERATOR GEN_DOWNLOADFILES;
CREATE GENERATOR GEN_DOWNLOAD;

COMMIT;

SET TERM ^ ;

CREATE TRIGGER INSERTDOWNLOADFILES FOR DOWNLOADFILES ACTIVE
BEFORE INSERT POSITION 0
AS 
BEGIN 
 IF (NEW.DF_ID IS NULL) THEN   
    NEW.DF_ID=GEN_ID(GEN_DOWNLOADFILES,1);
END^

CREATE TRIGGER INSERTDOWNLOAD FOR DOWNLOAD ACTIVE
BEFORE INSERT POSITION 0
AS 
BEGIN 
 IF (NEW.DL_ID IS NULL) THEN   
   NEW.DL_ID=GEN_ID(GEN_DOWNLOAD,1);
END^

COMMIT ^

SET TERM ;