Subject RE: [IBO] Re: Strange error
Author Jason Wharton
What probably should be done is allow it to prepare and then if an exception
happens parse the PLAN clause out of the FRefinedSQL variable and then
attempt to prepare it again. If the PLAN was the problem it will then be
removed.

Jason

> -----Original Message-----
> From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]On
> Behalf Of Stephen Boyd
> Sent: Thursday, October 20, 2005 1:47 PM
> To: IBObjects@yahoogroups.com
> Subject: [IBO] Re: Strange error
>
>
> Jason;
>
> I put the following of code just before the call to isc_dsql_prepare:
>
> SQLPlan.Text := '';
>
> Unfortunately, this doesn't do any good because the prepare is
> preparing FRefinedSQL which is not affected by setting SQLPlan.
> Maybe I am putting this in the wrong place. The code now looks like
> this:
>
> procedure TIB_BindingCursor.GetPrepare;
> var
> SaveCW: word;
> MonitorText: string;
> begin
> FNeedPrepare := true;
> with IB_Session do
> begin
> if PstHandle^ = FakePointer then
> PstHandle^ := nil;
> SysAllocate;
> asm fstcw [SaveCW] end;
> -->SQLPlan.Text := '';
> -->errcode := isc_dsql_prepare( @status,
> PtrHandle,
> PstHandle,
> null_terminated,
> PChar( FRefinedSQL ),
> IB_Connection.SQLDialect,
> CursorFields.PSQLDA );
> asm fldcw [SaveCW] end;
>
>
>
> > what I recommend you do is go inside IBO's source (let me know
> > if you are not comfortably doing this) and alter the code so that
> > it wipes
> > out the SQLPlan prior to preparing the internal cursor that is
> > causing the error.
> >
> > Jason Wharton