Subject Re: [firebird-support] Autocommit
Author enmaca
At 19:31 9/24/2003 -0300, you wrote:
>Is there a way to set a server/database to autocommit after each command?
>
>I'm using the .NET provider and if I issue a command without a transaction,
>it complains.
>If this is configurable, I'm not sure if it's in the database, or if there's
>an "autocommit emulation" in some layer above (?)
>
>Thanks in advance!!
>Luciano Passuello

CREATE TABLE TABLE1 (
FIELD_ID INTEGER NOT NULL,
FIELD_NAME VARCHAR(20) )

ALTER TABLE TABLE1 ADD CONSTRAINT PK_FID PRIMARY KEY (FIELD_ID);

CREATE GENERATOR FIELD_ID_GEN;

/* Trigger: AUTO_FD_ID */
CREATE TRIGGER AUTO_FD_ID FOR TABLE1 ACTIVE
BEFORE INSERT POSITION 0
AS
BEGIN
IF ( NEW.FIELD_ID IS NULL ) THEN
BEGIN
NEW.FIELD_ID = GEN_ID(FIELD_ID_GEN, 1);
END
END

YOU NEED TO NOTE, A
INSERT INTO TABLE1 ( FIELD_NAME ) VALUES ( 'TEST' ); // AUTOINCREMENTS FIELD_ID
INSERT INTO TABLE1 ( FIELD_ID, FIELD_NAME ) VALUES ( 1, 'TEST2' ); // NO
AUTOINCREMENT FIELD_ID




[Non-text portions of this message have been removed]