Subject | Re: [IBO] onpreparesql & odd behaviour ----fix & ATTN Jason |
---|---|
Author | petegajria |
Post date | 2002-06-27T21:06:38Z |
Delphi 6 enterprise sp2 + ibobjects 4.2He
im only using TIBOQuery at the moment
so here is my workaround & this one is really bizzare
FQueryList was in the protected section of the class
I moved it outside the class ....making it a global
& now everything works....
geez that has to be the dumbest bug to run into... :)
Daniel please confirm the above in your code.
Jason please look into these issues
thanks
pete
im only using TIBOQuery at the moment
so here is my workaround & this one is really bizzare
FQueryList was in the protected section of the class
I moved it outside the class ....making it a global
& now everything works....
geez that has to be the dumbest bug to run into... :)
Daniel please confirm the above in your code.
Jason please look into these issues
thanks
pete
--- In IBObjects@y..., Daniel Rail <daniel@a...> wrote:
> At 27/06/2002 03:37 PM, you wrote:
> >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.....
>
> You are right the code is straight forward. And I can confirm the
error,
> and it only happens if you assign the method to the event in run-
time. I
> even tried with only 1 TIBOQuery on the datamodule, the same error
> occurs. An error(EAccessViolation) occurs when using TIB_Query
with the
> same code adapted for TIB_Query. The EAccessViolation error occurs
when
> trying to add to SQLWhereItems. For TIBOQuery, I was able to
isolate the
> error occurring when it's trying to make reference to
> InternalDataset.SQLWhereItems. In the case for TIB_Query, the
error occurs
> as soon as you try to reference SQLWhereItems.
>
> Unfortunately, I don't have a solution at the moment for you.
Maybe,
> someone else might have an idea.
>
> Jason, if you want, I can send you a small test app, so you could
see for
> yourself.
>
>
> Daniel Rail
> Senior System Engineer
> ACCRA Group Inc. (www.accra.ca)
> ACCRA Med Software Inc. (www.accramed.ca)