Subject Re: [IBO] TIB_Script: Working with Macros
Author Heri
> >Any hints why OnMacroSubstitute does not fire?
>
> Only a hint: I am flat-out and don't have time to test your example
> myself, but since the OnStatement event *does* fire, my guess is that
> 'connect database' is throwing a parser error before the parser even
> reaches the macro. What does the SQL Monitor reveal?
>
> Helen
>

I think the parsing is done after the handling of macros (should make
sense!). As said, the OnStatement is fired and I see there the correct first
statement (with unreplaced macro of course), including a huge comment (file
header of script) before this statement.

I have changed the double quotes to single quotes. But the problem remains.
*With* the keyword 'database' it works (parser recognizes it as connect
statement -> the path is afterwards automatically assigned to the
IB_Connection), without not (parser does not recognize it at all -> raise
EIB_StatementError.Create( E_INV_CREATE_CONNECT_DROP );). As stated in the
other post (TIB_Script: connect syntax), the parser looks explicitely for
'database' or 'theme' after the keyword 'connect'.
Since the correct path was assigned to the IB_Connection after the parsing
(also username and password were assigned like this), an automatic connect
happens afterwards (see monitor output below) when trying to execute the
next statement in the script.

But I think this has nothing to do with the macro problem.

Heri


IB_Monitor output:

connect database
'D:\DATEN\HERI\PROGRAMMIEREN\PROJEKTE\KULTI\KULTINFO\DB\KULTINFO.GDB' user
'SYSDBA' password 'masterkey'

PARAMS = [ ]

ERRCODE = 335544324
----*/
/*---
CONNECT DATABASE
D:\DATEN\HERI\PROGRAMMIEREN\PROJEKTE\KULTI\KULTINFO\DB\KULTINFO.GDB
DB_HANDLE = 14622504

SECONDS = 0.271
----*/
/*---
DATABASE INFO
DB_HANDLE = 14622504

SECONDS = 0.020
----*/
/*---
START TRANSACTION
DB HANDLE COUNT 1
TR_HANDLE = 14622368

SECONDS = 0.020
----*/
/*---
EXECUTE IMMEDIATE
DB_HANDLE = 14622504
TR_HANDLE = 14622368

create domain WortDomain as char(24)

...