Subject | Re: [IBO] TIB_Script macros |
---|---|
Author | Geoff Worboys |
Post date | 2001-07-23T08:35:27Z |
> If you are currently to busy to help me, are there anyNot sure if I know exactly what Jason is looking for but since I
> other IBO guru's I can plague with stupid questions like
> the ones above?
already use macros at the statement level (to expand various filters
etc) this is my understanding of how it should work. Note: This is
with just a few minutes thought, keep in mind that this is not tested
and can could contain holes :-)
TIB_Connection will have two properties (which dont currently exist,
but you are about to introduce); MacroBegin and MacroEnd.
These are to be string properties defaulting to '<' and '>' or '[' and
']' (please let me know which because my current app will need
changing! (By default I mean that the values are not stored when not
changed at designtime.)
There are a few different ways to implement things at the
TIB_Statement and TIB_Script level. I suggest...
Setup the statement/script level properties so that they only store
the MacroBegin/MacroEnd values when different to the connection, and
so that they use get/set functions. eg.
property MacroBegin: string read GetMacroBegin write SetMacroBegin
stored IsMacroBeginStored;
function TIB_Statement.GetMacroBegin: string;
begin
if assigned(IB_Connection) then
begin
if FMacroBegin = '' then
Result := IB_Connection.MacroBegin
else
Result := FMacroBegin;
end
else
Result := FMacroBegin;
end;
procedure TIB_Statement.SetMacroBegin( AVal: string );
begin
if AVal <> MacroBegin then
begin
if assigned(IB_Connection) then
begin
if AVal = IB_Connection then
FMacroBegin := ''
else
FMacroBegin := AVal;
end
else
FMacroBegin := FMacroBegin;
end;
end;
function TIB_Statement.IsMacroBeginStored: boolean;
begin
Result := (FMacroBegin <> '');
if Result and assigned(IB_Connection) then
begin
Result := (FMacroBegin <> IB_Connection.MacroBegin)
end;
end;
I think this should work, and it has the advantage of not impacting
other areas of the IBO code (although you may want to do a search for
the use of FMacroBegin and FMacroEnd to be sure they are not used
outside the property access functions).
Geoff Worboys
Telesis Computing