Subject | Re: [IBO] TIBOQUERY Problem |
---|---|
Author | Jason Wharton |
Post date | 2001-11-29T20:06:52Z |
Ok, here is what we learn from the implementation of the method responsible
for triggering the FetchAll:
Result := NodeList.LookupBufferNode( KeyFields.OldBuffer );
if not Result and
not CursorIsKeyFields and
not KeyLinksExist and
not BufferHasEof then
FetchAll;
The most ideal way for you to avoid this is to fulfill the requirements
above to avoid it.
Most notable here is you apparently do not have your KeyLinks properly
defined.
Please put a breakpoint on the FetchAll and then ascertain the values of the
conditions above and tell me why it is getting to this particular line of
code.
I would be curious to know what you think of implementing it this way:
Result := NodeList.LookupBufferNode( KeyFields.OldBuffer );
if not Result and
not CursorIsKeyFields and
not KeyLinksExist and
not BufferHasEof then
begin
repeat
if not BufferHasBof then
ValidateRows( BofRowNum - 500, BofRowNum );
if not BufferHasEof then
ValidateRows( EofRowNum, EofRowNum + 500 );
Result := NodeList.LookupBufferNode( KeyFields.OldBuffer );
until Result or ( BufferHasBof and BufferHasEof );
end;
Please change your sources to do this instead of the FetchAll and see if it
actually pulls it in more efficiently looking at a block of 500-1000 records
at a time.
For the curious, here is the whole original implementation of this method:
function TIB_BDataset.SeekKeyForBufferFields(
var ANodeRef: TIB_NodeRef ):
boolean;
begin
Result := NodeList.LookupBufferNode( KeyFields.OldBuffer );
if not Result and
not CursorIsKeyFields and
not KeyLinksExist and
not BufferHasEof then
begin
FetchAll; file://!!! This needs to be optimized!
Result := NodeList.LookupBufferNode( KeyFields.OldBuffer );
end;
if Result then
begin
ANodeRef := NodeList.BufRef;
if ( ANodeRef.Pos > NodeList.BofRef.Pos ) then
begin
if NodeList.FilterDel then
if rfDeleted in NodeList.BufRef.Node.RowFlags then
ANodeRef.Pos := NodeList.BofRef.Pos;
if NodeList.Filtered then
if rfFiltered in NodeList.BufRef.Node.RowFlags then
ANodeRef.Pos := NodeList.BofRef.Pos;
end;
if ANodeRef.Pos <> NodeList.BofRef.Pos then
begin
if KeyLinksExist or Assigned( NodeList.BufRef.Node.RecordData ) then
FBufferCursor.QuickFetch( NodeList.BufRef.Node, false, false );
Result := ANodeRef.Pos > NodeList.BofRef.Pos;
end;
end
else
ANodeRef := InvalidNodeRef;
end;
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
for triggering the FetchAll:
Result := NodeList.LookupBufferNode( KeyFields.OldBuffer );
if not Result and
not CursorIsKeyFields and
not KeyLinksExist and
not BufferHasEof then
FetchAll;
The most ideal way for you to avoid this is to fulfill the requirements
above to avoid it.
Most notable here is you apparently do not have your KeyLinks properly
defined.
Please put a breakpoint on the FetchAll and then ascertain the values of the
conditions above and tell me why it is getting to this particular line of
code.
I would be curious to know what you think of implementing it this way:
Result := NodeList.LookupBufferNode( KeyFields.OldBuffer );
if not Result and
not CursorIsKeyFields and
not KeyLinksExist and
not BufferHasEof then
begin
repeat
if not BufferHasBof then
ValidateRows( BofRowNum - 500, BofRowNum );
if not BufferHasEof then
ValidateRows( EofRowNum, EofRowNum + 500 );
Result := NodeList.LookupBufferNode( KeyFields.OldBuffer );
until Result or ( BufferHasBof and BufferHasEof );
end;
Please change your sources to do this instead of the FetchAll and see if it
actually pulls it in more efficiently looking at a block of 500-1000 records
at a time.
For the curious, here is the whole original implementation of this method:
function TIB_BDataset.SeekKeyForBufferFields(
var ANodeRef: TIB_NodeRef ):
boolean;
begin
Result := NodeList.LookupBufferNode( KeyFields.OldBuffer );
if not Result and
not CursorIsKeyFields and
not KeyLinksExist and
not BufferHasEof then
begin
FetchAll; file://!!! This needs to be optimized!
Result := NodeList.LookupBufferNode( KeyFields.OldBuffer );
end;
if Result then
begin
ANodeRef := NodeList.BufRef;
if ( ANodeRef.Pos > NodeList.BofRef.Pos ) then
begin
if NodeList.FilterDel then
if rfDeleted in NodeList.BufRef.Node.RowFlags then
ANodeRef.Pos := NodeList.BofRef.Pos;
if NodeList.Filtered then
if rfFiltered in NodeList.BufRef.Node.RowFlags then
ANodeRef.Pos := NodeList.BofRef.Pos;
end;
if ANodeRef.Pos <> NodeList.BofRef.Pos then
begin
if KeyLinksExist or Assigned( NodeList.BufRef.Node.RecordData ) then
FBufferCursor.QuickFetch( NodeList.BufRef.Node, false, false );
Result := ANodeRef.Pos > NodeList.BofRef.Pos;
end;
end
else
ANodeRef := InvalidNodeRef;
end;
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
----- Original Message -----
From: "Andy Murphy" <andy@...>
Newsgroups: egroups.ibobjects
To: <IBObjects@yahoogroups.com>
Sent: Wednesday, November 28, 2001 5:19 PM
Subject: Re: [IBO] TIBOQUERY Problem
> Ok,
>
> I followed your instructions when it did this hang up and the break point
> was:
>
> asm fldcw [SaveCW] end;
>
> and the callstack had:
>
> TIB_Dataset.SysFetchNext
> TIB_Dataset.SysFetchAll(???)
> TIB_Dataset.FetchAll
> TIB_BDataset.SeekKeyForBufferFields(($5FFD64, 0, 19375052, 13991936, 0))
> TIB_BDataset.LookupKeyForBufferFields
> TIB_BDataset.SetBufferBookmark(???)
> TIBODataset.CompareBookmarks($127A394,$127C88C)
> TCustomdxDBTreeListControl.CompareBkm(???,???)
> AssignNode(???)
> TCustomdxDBGrid.GetNextNodes(lmCurrent,rmNone,False)
> TCustomdxDBGrid.LoadGroupList(nil)
> TCustomdxDBGrid.ReLoadGroupList
> TCustomdxDBGrid.LinkActive(???)
>
TCustomdxDBGrid.SetOptionsDB([edgoCancelOnExit,edgoPartialLoad,edgoUseBookma
> rks])
> TForm1.doopenlist
> TForm1.dxDBTreeList1KeyDown(???,???,[])
> TCustomdxDBTreeList.KeyDown(13,[])
>
> Thanks.