Subject | FW: Important RE: [IBO] IBOQuery and Refresh |
---|---|
Author | Jason Wharton |
Post date | 2007-09-27T21:18:20Z |
-----Original Message-----
From: Jason L. Wharton [mailto:jwharton@...]
Sent: Wednesday, September 19, 2007 7:55 PM
To: IBObjects@yahoogroups.com
Cc: 'Helen Borrie'
Subject: RE: Important RE: [IBO] IBOQuery and Refresh
Helen,
(I hope this makes it to the list.)
The problem actually showed up in native IBO if the RefreshAction was set to
raKeepDataPos. It had to do with the behind the scenes query checking to
see if the record the pointer was on prior to the refresh was still in the
dataset and it used a query to do that. This query has input parameters and
they were thrown off by the oldparamorder problem.
PS. The MakeLookupSQL() method may be different in the fix and so if there
is an error just remove that extra parameter and make it so that it will
compile. That is a result of changes that I made before I fully understood
what the problem was and they are not essential for this fix.
Jason
From: Jason L. Wharton [mailto:jwharton@...]
Sent: Wednesday, September 19, 2007 7:55 PM
To: IBObjects@yahoogroups.com
Cc: 'Helen Borrie'
Subject: RE: Important RE: [IBO] IBOQuery and Refresh
Helen,
(I hope this makes it to the list.)
The problem actually showed up in native IBO if the RefreshAction was set to
raKeepDataPos. It had to do with the behind the scenes query checking to
see if the record the pointer was on prior to the refresh was still in the
dataset and it used a query to do that. This query has input parameters and
they were thrown off by the oldparamorder problem.
PS. The MakeLookupSQL() method may be different in the fix and so if there
is an error just remove that extra parameter and make it so that it will
compile. That is a result of changes that I made before I fully understood
what the problem was and they are not essential for this fix.
Jason
> -----Original Message-----
> From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On
> Behalf Of Helen Borrie
> Sent: Wednesday, September 19, 2007 6:19 PM
> To: IBObjects@yahoogroups.com
> Subject: Re: Important RE: [IBO] IBOQuery and Refresh
>
> At 06:24 PM 13/09/2007, I wrote:
>
> >In fact, Petr really has discovered a regression bug. I've set up
> >some test cases for Jason using Petr's sample database but, in the
> >meantime, ParameterOrder support in IBO 4.8.x is not working safely
> >for TDataset components. You will need to configure
> >OldParameterOrdering=1 in firebird.conf for both Fb 1.5.x and 2.x.
> >
> >NOTE There is no sign of the problem in the native TIB_ data access.
>
> Jason has done a fix for this bug. For Petr Hartman and others who would
> like
> to test it, the fix is copied below. A new sub-release will follow soon.
>
> Helen
>
> ==========================================================
> The fix is in IB_Components.pas
>
> function TIB_BDataset.SysLookupKeyForBufferFields(
> ANodeRef: TIB_NodeRef ):
> boolean;
> var
> tmpNode: PIB_Node;
> procedure DoScrollFailed;
> begin
> with NodeList, KeyFields do
> begin
> Result := false;
> with tmpNode^ do
> begin
> if RecordData <> nil then
> FreeMem( RecordData, RecordLen );
> FreeMem( KeyData, BufferLength );
> end;
> FreeMem( tmpNode, SizEof( tmpNode ));
> end;
> end;
> procedure GetSeekCursor;
> var
> ii: integer;
> LookupSQL: string;
> FPrmCnt: integer;
> incAdj: integer;
> SPrmCnt: integer;
> SPrmAdj: integer;
> MonitorText: string;
> tmpOldParamOrder: boolean;
> begin
> tmpOldParamOrder := false;
> if Assigned( IB_Connection ) then
> tmpOldParamOrder := IB_Connection.OldParameterOrder;
> FPrmCnt := MakeLookupSQL( ServerSQL,
> KeySQLSelect,
> KeyLinks,
> LookupSQL,
> SPrmCnt,
> tmpOldParamOrder );
> if @FSeekCursor^ = nil then
> IB_Connection.AllocateStmtHandle( @FSeekCursor );
> incAdj := 0;
> if {( not Refined ) and} Assigned( OrderingParam ) then
> incAdj := 1;
>
> if Assigned( PSeekDA ) then
> begin
> FreeMem( PSeekDA );
> PSeekDA := nil;
> end;
> PSeekDA := AllocMem( XSQLDA_LENGTH( KeyFields.PSQLDA.SQLn +
> Params.PSQLDA.SQLn - incAdj ));
> PSeekDA.version := SQLDA_VERSION1;
> PSeekDA.sqld := KeyFields.PSQLDA.SQLn + Params.PSQLDA.SQLn - incAdj -
> SPrmCnt;
> PSeekDA.sqln := KeyFields.PSQLDA.SQLn + Params.PSQLDA.SQLn - incAdj -
> SPrmCnt;
> with IB_Session do
> begin
> errcode := isc_dsql_prepare( @status,
> PtrHandle,
> @FSeekCursor,
> Length( LookupSQL ),
> pchar( LookupSQL ),
> IB_Connection.SQLDialect,
> KeyFields.PSQLDA );
> if ( errcode = 0 ) then
> begin
> FSeekCursorPrepared := true;
> if ClientMonitorHooksIn then
> begin
> MonitorText :=
> '//>>> STATEMENT PREPARED <<<//'#13#10 +
>
> 'TIB_BDataset.SysLookupKeyForBufferFields.GetSeekCursor()'#13#10 +
> Self.ClassName + ': "';
> if Assigned( Self.Owner ) and ( Self.Owner.Name <> '' ) then
> MonitorText := MonitorText + Self.Owner.Name + '.';
> MonitorText := MonitorText + Self.Name +
> '" stHandle=' + IntToStr(Integer(@FSeekCursor^)) + ' #SC';
> OutputToMonitor( MonitorText );
> end;
> end
> else
> HandleException( Self );
> end;
> for ii := 0 to FPrmCnt - 1 do
> PSeekDA.SQLVAR[ii] := Params.PSQLDA.SQLVAR[ii];
> for ii := 0 to KeyFields.PSQLDA.SQLn - 1 do
> PSeekDA.SQLVAR[ii + FPrmCnt] := KeyFields.PSQLDA.SQLVAR[ii];
> SPrmAdj := SPrmCnt;
> if tmpOldParamOrder then
> SPrmAdj := 0;
> for ii := 0 to Params.PSQLDA.SQLn - 1 - FPrmCnt - incAdj - SPrmCnt do
> PSeekDA.SQLVAR[ii + FPrmCnt + KeyFields.PSQLDA.SQLn] :=
> Params.PSQLDA.SQLVAR[ii + FPrmCnt {jlw} + SPrmAdj {jlw}];
> end;
> .
>
>