Firebird News

Wednesday, August 27, 2008

For the new movies page i have created an movies table with the following structure

/****************** GENERATORS ********************/

CREATE GENERATOR GEN_MOVIES_ID;

/******************** TABLES **********************/

CREATE TABLE MOVIES
(
ID Integer NOT NULL,
FILENAME Varchar(512) NOT NULL,
PRIMARY KEY (ID)
);

/******************** TRIGGERS ********************/

SET TERM ^ ;
CREATE TRIGGER MOVIES_BI FOR MOVIES ACTIVE
BEFORE INSERT POSITION 0
AS

BEGIN

IF (NEW.ID IS NULL) THEN

NEW.ID = GEN_ID(GEN_MOVIES_ID, 1);

END^
SET TERM ; ^


GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE
ON MOVIES TO SYSDBA WITH GRANT OPTION;

No comments: