Subject Re: [firebird-support] Dynamic SQL Error SQL error code = -104. Unexpected end of command - line 7, column 47
Author Mark Rotteveel
On 10-6-2014 18:20, Arnold Levy arnoldjlevy@... [firebird-support]
> I suspect that the parser of Firebird SQL was written as a recursive
> decent implementation - judging from the poor error reporting. I heard
> that Firebird is written in C. A great LR grammar parser such as Hyacc -
> also written in C - which is an improvement on Bison - the original yacc
> is available. I believe that Hyacc would comfortably handle the
> Firebird/Interbase SQL grammar. Why this suggestion? - because accurate
> error reporting can be provided by using such an implementation of the
> parser.

Firebird itself only executes individual statements, the server itself
doesn't support executing scripts of multiple statement: it is the job
of the client to break up a script into individual statements.

This is usually done in the naive way isql does it: splitting input on a
semi-colon ";" and then sending the fragments as individual statements
to the server. Firebird itself doesn't know semi-colons, except within
PSQL blocks.

In your example, as Svein pointed out, it sends the statement

CREATE TRIGGER "TR_AI_Administrators__Id" FOR "Administrators"
NEW."_Id" = GEN_ID("GEN_Administrators__Id", 1)

To the server, this is entirely valid until the end of string is reached
where a semi-colon is expected. Would it have been helpful to receive a
message indicating what is missing: probably but I don't think that is a
top priority.

If you want to help improving Firebird and its error reporting, feel
free to join the Firebird-devel mailinglist and offer your help.

Mark Rotteveel