Subject | Re: [IBO] onpreparesql & odd behaviour |
---|---|
Author | petegajria |
Post date | 2002-06-27T18:37:34Z |
heres the relevant code fragments
FQueryList is declared in the classes protected section
//datamodule.create
var
I : Integer;
M : TMethod;
begin
FQueryList := TStringList.Create;
for I:=0 to ComponentCount -1 do
begin
if(Components[I] is TIBODataSet)then
begin
if IsPublishedProp(Components[I], 'OnPrepareSql') then
begin
M.Code := MethodAddress('QueryOnPrepareSql');
if Assigned(M.Code) then
SetMethodProp(Components[I], 'OnPrepareSql', M );
end; // OnPrepareSql
& heres the onpreparesql
procedure TDataSetDM.QueryOnPrepareSql(Sender : TObject);
begin
TIBOQuery(Sender).SQLWhereItems.AddStrings(FQueryList);
FQueryList.Clear;
end;
no rocket science here.....
ive checked & the querylist is being created before
the onprepare ever fires
again help would be greatly appreciated
regards
pete
FQueryList is declared in the classes protected section
//datamodule.create
var
I : Integer;
M : TMethod;
begin
FQueryList := TStringList.Create;
for I:=0 to ComponentCount -1 do
begin
if(Components[I] is TIBODataSet)then
begin
if IsPublishedProp(Components[I], 'OnPrepareSql') then
begin
M.Code := MethodAddress('QueryOnPrepareSql');
if Assigned(M.Code) then
SetMethodProp(Components[I], 'OnPrepareSql', M );
end; // OnPrepareSql
& heres the onpreparesql
procedure TDataSetDM.QueryOnPrepareSql(Sender : TObject);
begin
TIBOQuery(Sender).SQLWhereItems.AddStrings(FQueryList);
FQueryList.Clear;
end;
no rocket science here.....
ive checked & the querylist is being created before
the onprepare ever fires
again help would be greatly appreciated
regards
pete
--- In IBObjects@y..., Bender Heri <heribender@w...> wrote:
> > the events for all tiboq on a datamodule are being assigned at
runtime
> > via method pointers & rtti
> >
> Can you show this code? I assume this is the culprit.
>
> Heri