Subject Fixed one sql problem, found another
Author Liz
I can now use the sql task in Ant (figured out the class loader problem).

My DDL runs fine with isql, but I am getting an error with the sql
command in ant.

The problem I get is in trying to run the script below. This fails
with or without a concluding ";"


Error is
[sql] Executing file:
C:\workspace\newDataBuild\test\data\sql\firebird\create.sql
[sql] Failed to execute: CREATE TRIGGER AI_SANITY_ID FOR
SANITY ACTIVE BEFORE INSERT POSITION 0 AS BEGIN IF (NEW.ID IS NULL)
THEN NEW.ID = GEN_ID(SANITY_SEQ, 1)

BUILD FAILED
C:\workspace\newDataBuild\test\data\build.xml:44: The following error
occurred while executing this line:
C:\workspace\newDataBuild\test\data\helper\firebird\buildFirebird.xml:85:
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic
SQL Error
SQL error code = -104
Unexpected end of command


CREATE GENERATOR SANITY_SEQ ;
SET GENERATOR SANITY_SEQ TO 1;

CREATE TABLE SANITY (
ID INTEGER NOT NULL,
NAME VARCHAR (10) CHARACTER SET WIN1251 NOT NULL COLLATE WIN1251);



ALTER TABLE SANITY ADD CONSTRAINT PK_SANITY PRIMARY KEY (ID);

CREATE TRIGGER AI_SANITY_ID FOR SANITY ACTIVE
BEFORE INSERT POSITION 0
AS
BEGIN
IF (NEW.ID IS NULL) THEN
NEW.ID = GEN_ID(SANITY_SEQ, 1);
END


If I then edit the script so that the trigger command is

CREATE TRIGGER AI_SANITY_ID FOR SANITY ACTIVE
BEFORE INSERT POSITION 0
AS
BEGIN
IF (NEW.ID IS NULL) THEN
NEW.ID = GEN_ID(SANITY_SEQ, 1)
END;

The error becomes

[sql] Executing file:
C:\workspace\newDataBuild\test\data\sql\firebird\create.sql
[sql] Failed to execute: CREATE TRIGGER AI_SANITY_ID FOR
SANITY ACTIVE BEFORE INSERT POSITION 0 AS BEGIN IF (NEW.ID IS NULL)
THEN NEW.ID = GEN_ID(SANITY_SEQ, 1) END

BUILD FAILED
C:\workspace\newDataBuild\test\data\build.xml:44: The following error
occurred while executing this line:
C:\workspace\newDataBuild\test\data\helper\firebird\buildFirebird.xml:85:
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic
SQL Error
SQL error code = -104
Token unknown - line 1, char 139
END