Hi!

Due to ISQL dumbness statement processing, SET TERM is an essential
feature to write procedures/functions/triggers and execute block.

But ISQL already has some smartness to not detect the terminator inside
quoted identifiers, strings and comments.

I propose that we count BEGIN/END pairs as it's very easy to do.

It seems as a safe feature to even be enabled by default. My experiment
running with TCS shows no error due to it.

In my understand, it could change only places that without this
smartness already creates statements with errors.

But of course, we may also be safe and implement it non enabled by default.

I think SET AUTOTERM [ON/OFF] would be necessary anyway, so one can
disable it.

So my proposal is:

- Add SET AUTOTERM [ON/OFF]
- The TERM string (of SET TERM) will be detected only outside
BEGIN...END when AUTOTERM is ON.
- Add a command line switch to turn AUTOTERM ON or OFF, depending on the
default value we choose for it
- If we choose AUTOTERM default to OFF in v4, we may rethink for the
next version
- If for a giving moment in the statement processing there is more END
than BEGIN, AUTOTERM is disabled in that statement and the next TERM is
detected as statement end.

Here is a valid ISQL code with "TERM ;" and "AUTOTERM ON":

----------
SQL> execute block returns (x integer) as
CON> begin
CON>   x = 1;
CON>   suspend;
CON>   x = 2;
CON>   suspend;
CON>   begin
CON>     x = 3;
CON>     suspend;
CON>   end
CON> end;

           X
============
           1
           2
           3
----------


Adriano

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to