Subject | Re: [IBO] TIB_Script macros |
---|---|
Author | Jason Wharton |
Post date | 2001-07-20T08:49:01Z |
It happens during the PrepareSQL phase towards the end of it. Obviously it
has to happen prior to the statement being prepared, not just executed.
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
has to happen prior to the statement being prepared, not just executed.
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
----- Original Message -----
From: "Don Schoeman" <ds@...>
To: <IBObjects@yahoogroups.com>
Sent: Friday, July 20, 2001 1:07 AM
Subject: RE: [IBO] TIB_Script macros
> Thank you Lele,
>
> It seems simple enough. At what stage is the SQL containing the macro
> strings parsed though? Is it before the SQL statement is executed?
>
> Best Regards,
> Don Scoeman
>
> -----Original Message-----
> From: Lele Gaifax [mailto:lele@...]On Behalf Of Lele Gaifax
> Sent: 20 July 2001 09:44
> To: IBObjects@yahoogroups.com
> Subject: Re: [IBO] TIB_Script macros
>
>
> >>>>> On Fri, 20 Jul 2001 09:11:51 +0200, "Don Schoeman" <ds@...>
> said:
>
> DS> Is there an example somewhere on how to use the TIB_Script
> DS> macro substitution facility? Or could someone give me a quick
> DS> example.
>
> It's very easy: you must implement a method like this
>
> procedure TMyForm.SubstSubquery (Sender: TIB_Component;
> const ATextBlock: string;
> var ATextResult: string);
> begin
> if ATextBlock = 'THEMACRO' then
> ATextResult := 'The Macro Expanded';
> else if ATextBlock = 'THECONDITION' then
> ATextResult := 'theField IN (1, 2, 4)';
> end
>
> then assign it to the OnMacroSubstitute of you preferred IB_ query,
> that may contain something like
>
> SELECT f1, f2, f2 as <<THEMACRO>>
> FROM table
> WHERE <<THECONDITION>>
>
> The method will be colled once for each macro.
>
> Hope this helps,
> bye, lele.
> --
> nickname: Lele Gaifax | Quando vivro' di quello che ho pensato ieri
> real: Emanuele Gaifas | comincero' ad aver paura di chi mi copia.
> email: lele@... | -- Fortunato Depero, 1929.