Subject Re: [IBO] IBQuery and Token Unknown for COMMIT, SET, and TERM
Author Helen Borrie
At 12:02 PM 25/01/2006, you wrote:
>w/IBODatabase, IBQuery and FB 1.0.0.794
>
>When I execute the complete script below in IB_SQL
>(as a new db with the required GENERATOR), it returns
>without error.
>
>When I run it through IBOQuery flattened out as a single
>string, it returns "Token Unknown" on the first COMMIT.
>
>(The rationale for this is that the 'DBNOTES1' in the script
>below gets replaced in the string so that I can create
>additional tables.)
>
>If I remove that first COMMIT, it returns "Token Unknown"
>on SET in the SET TERM in preparation for the trigger.
>
>The script (sections):
>
>CREATE TABLE DbNotes1(
> NoteID INTEGER NOT NULL PRIMARY KEY,
> Subject VARCHAR(36) NOT NULL UNIQUE,
> Notes BLOB,
> CreateDateStmp DATE,
> CreateTimeStmp TIME,
> EditDateStmp DATE,
> EditTimeStmp TIME
> );
>COMMIT;
>
>/* The generator referred to below is already
> created in the db */
>
>SET TERM !! ;
>CREATE TRIGGER BI_DBNOTES1 FOR DBNOTES1
>ACTIVE BEFORE INSERT
>AS
>BEGIN
> IF (NEW.NOTEID IS NULL) THEN
> NEW.NOTEID = GEN_ID(NOTEID_GEN, 1);
>END!!
>SET TERM ; !!
>COMMIT;
>
>CREATE INDEX DbNotes1SubIdx ON DbNotes1(Subject);
>COMMIT;
>
>If I eliminate the first COMMIT after the CREATE TABLE
>and ExecSQL (runs OK), Close and Clear that IBOQuery, and
>then run IBOQuery.SQL for the SET TERM trigger script (above),
>it returns "Token Unknown" for TERM.
>
>I presume that there are some clues to running DSQL
>through an IBQuery (or other similar components)
>that I need to become aware of.

Erm, yes. A statement object such as TIBOQuery is for a single
statement. If you want to run a script, use a TIB_Script component!

Helen