Subject | RE: [IBO] is there bug on terminator? |
---|---|
Author | Helen Borrie |
Post date | 2007-08-23T00:05:46Z |
At 08:31 AM 23/08/2007, you wrote:
allowed, they should behave as they do in ISQL.
In ISQL a terminator can be any sequence of characters (including
embedded blanks) and leading and trailing blanks are ignored:
c:\Program Files\Firebird\Firebird_1_5\bin>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> set term ^^;
SQL> show sql dialect^^
Client SQL dialect has not been set and no database has been connected yet.
SQL> set term ;;;^^
SQL> show sql dialect;;;
Client SQL dialect has not been set and no database has been connected yet.
SQL> set term ;;;;
SQL> show sql dialect;
Client SQL dialect has not been set and no database has been connected yet.
SQL> set term^;
Command error: set term^
SQL> set term ^ ;
SQL> show sql dialect^
Client SQL dialect has not been set and no database has been connected yet.
SQL> set term @ @^
SQL> show sql dialect@ @
Command error: show sql dialect@
SQL> show sql dialect @ @
Client SQL dialect has not been set and no database has been connected yet.
SQL>
According to ISQL rules, the reason why the bad token error occurred
was because there was NO space between the keyword END and the terminator.
switching is actually *valid*) that you are allowed to have zero
white space between a syntax element when the terminator is a
semi-colon but not when it is anything else. I think (STRONGLY!!)
that, if you are going to change the terminator-handling behaviour,
you should aim to make it consistent with ISQL, including ISQL's own
inconsistency, so that it will be possible to use an isql-created
script as the input to an ib_script and vice versa.
It would be interesting for Antonio to tell us exactly where he
bumped into this problem:
-- If it was in executing an ib_script then there is a case for
fixing the script parser to get it into line with isql.
-- If it was in the DSQL tab of IB_SQL (as it appears from his
original posting) then the mistake was in attempting to use
terminator switching commands at all in that environment....
Helen
>Antonio,I disagree with this as a principle. If terminators are going to be
>
> > Hi there!
> >
> > // ------------ Scenario:
> >
> > Delphi 7
> > FirebirdSQL 1.5.4
> > IBObjects 4.8.6
> > IB_SQL 4.7.Beta 15 (for testing purposes)
> >
> > // ------------ In a trigger like this:
> >
> > SET TERM !! ;
> > CREATE OR ALTER TRIGGER SET_GEN_L_CRITICA FOR MYTABLE
> > BEFORE INSERT AS BEGIN
> > DELETE FROM MYTABLE2;
> > END!!
> > SET TERM ; !!
> >
> > // ------------ I got the following message:
> >
> > Token Unknown - line 4, char 4
> >
> > // ------------ Adding a space between END and !! it works:
> >
> > ...
> >
> > END !!
> > SET TERM ; !!
> >
> > // ---------------------------------------------------------
> >
> > Am I missing something?
>
>The way you declared your terminator put a space after it:
>
>SET TERM !! ;
allowed, they should behave as they do in ISQL.
In ISQL a terminator can be any sequence of characters (including
embedded blanks) and leading and trailing blanks are ignored:
c:\Program Files\Firebird\Firebird_1_5\bin>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> set term ^^;
SQL> show sql dialect^^
Client SQL dialect has not been set and no database has been connected yet.
SQL> set term ;;;^^
SQL> show sql dialect;;;
Client SQL dialect has not been set and no database has been connected yet.
SQL> set term ;;;;
SQL> show sql dialect;
Client SQL dialect has not been set and no database has been connected yet.
SQL> set term^;
Command error: set term^
SQL> set term ^ ;
SQL> show sql dialect^
Client SQL dialect has not been set and no database has been connected yet.
SQL> set term @ @^
SQL> show sql dialect@ @
Command error: show sql dialect@
SQL> show sql dialect @ @
Client SQL dialect has not been set and no database has been connected yet.
SQL>
According to ISQL rules, the reason why the bad token error occurred
was because there was NO space between the keyword END and the terminator.
>For it to do what you want or expect you should do this:It is an inconsistency in ISQL (the only environment where terminator
>
> > SET TERM !!;
>The question here is do you think I should trim the whitespace.
>I don't think this was intentional and trimming the whitespace would
>probably be a good idea.
>
>What do others think?
switching is actually *valid*) that you are allowed to have zero
white space between a syntax element when the terminator is a
semi-colon but not when it is anything else. I think (STRONGLY!!)
that, if you are going to change the terminator-handling behaviour,
you should aim to make it consistent with ISQL, including ISQL's own
inconsistency, so that it will be possible to use an isql-created
script as the input to an ib_script and vice versa.
It would be interesting for Antonio to tell us exactly where he
bumped into this problem:
-- If it was in executing an ib_script then there is a case for
fixing the script parser to get it into line with isql.
-- If it was in the DSQL tab of IB_SQL (as it appears from his
original posting) then the mistake was in attempting to use
terminator switching commands at all in that environment....
Helen