Subject Re: Strange error
Author Stephen Boyd
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> Wrong InterBase or Firebird message file?
>

Nope, not a wrong message file. After an hour or so with the
debugger here is what I have found:

Original contents of TIBOQuery SQL:

SELECT LDS_NAME
FROM LD_STOP
WHERE LDS_TEMPLATE_FLAG = 'N' AND
LDS_LOCATION = :LDS_LOCATION AND
LDS_LOAD_NUMBER = :LDS_LOAD_NUMBER AND
LDS_LOAD_SFX = :LDS_LOAD_SFX AND
LDS_STOP_NUMBER = :LDS_STOP_NUMBER
PLAN (LD_STOP INDEX (LDS_STOP_KEY))

In IB_Components.TIB_BindingCursor.GetPrepare IBO is trying to
prepare the following SQL:

SELECT LDS_NAME, LD_STOP.RDB$DB_KEY
FROM LD_STOP
WHERE LD_STOP.RDB$DB_KEY=? /* BIND_0 */
PLAN (LD_STOP INDEX (LDS_STOP_KEY))

Snippet of code showing offending section:

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;
--> errcode := isc_dsql_prepare( @status,
PtrHandle,
PstHandle,
null_terminated,
PChar( FRefinedSQL ),
IB_Connection.SQLDialect,
CursorFields.PSQLDA );
asm fldcw [SaveCW] end;
//ADDED// CW 2000-06-06
if ( errcode = 0 ) and ClientMonitorHooksIn then
begin


This is obviously incorrect. It would appear to be a bug in IBO when
attempting to handle SELECT statements with a PLAN specified.

Stack trace back:

TIB_BindingCursor.GetPrepare
TIB_BindingCursor.QuickFetch($1CB3034,False,False)
TIB_BDataset.SysLookupKeyForBufferFields((nil, -2147483647, 0, 0, 0))
TIB_BDataset.LookupKeyForFields
TIB_BDataset.SetBookmark(???)
TIB_Dataset.SysRefresh(False,???)
TIBOInternalDataset.SysRefresh(False,True)
TIB_Dataset.RefreshKeys
TIB_Transaction.SysProcessCommitAction(False,True,False,False)
TIB_Transaction.SysCommitEnd(False)
TIB_Transaction.SysCommit(???)
TIB_Transaction.Commit
TIB_Database.Commit
TTC_0011Form.OkBtnClick(???)
TC_0011