Subject Re: [IBO] TIB_Script: Working with Macros (Bug-Report)
Author Heri
> Please try a simple case and see if it makes a difference.
> Use the default of <<MyMACRO>> and see if it works for you.
>
> Jason Wharton


Hi Jason

If the script uses the the default macros "<<" and ">>", it works (or any
other value defined on the level of the TIB_Connection).

The problem is that the TIB_Script does not expose the changed properties to
the underlying FDSQL which is responsible to parse and execute a particular
script statement. The FDSQL.BeginMacro stays an EmptyStr, so the check if
there should be a macro substitution is done only against the values defined
in the connection property. I consider this a bug.

Solution(s):
-----------
A:
insert at in IB_Script.pas, line 284 (before the call to
FDSQL.ExecuteImmediate):

FDSQL.MacroBegin := FMacroBegin;
FDSQL.MacroEnd := FMacroEnd;


B:
Do this assignemet in the property get/set methods since FDSQL is created
already in constructor.


C:
Replace the storing of the property in the script (FMacroBegin) with the
property of the underlying FDSQL:

procedure TIB_Script.SetMacroBegin( AValue: string );
var
s : string;
begin
s := aValue;
if (s <> FDSQL.MacroBegin) then
begin
if Assigned(IB_Connection) then
begin
if s = IB_Connection.MacroBegin then
s := ''
else
s := Trim(s);
end
else
s := Trim(s);
FDSQL.MacroBegin := s;
end;
end;

Heri Bender