Subject Need help with Locate() (another issue).
Author Dany Marmur
Hi again!

This puzzles me. If anyone would take the time to answer I'd be very
thankful.

I have a table with 16000 rows and a primary key containing three fields
CHAR(5), CHAR(2) and CHAR(2). The thing is it's a composite primary key.
There are only three more fields in this table (VARCHAR(20), CHAR(2) and
CHAR(2). I open the following query;

object IB_Query7: TIB_Query
DataBase = '/opt/database/ABASE.GDB'
IB_Connection = IB_Connection1
IB_Transaction = IB_Transaction1
SQL.Strings = (
'SELECT *'
'FROM TABLE')
CallbackInitInt = 500
ColorScheme = True
KeyLinks.Strings = (
'TEST.PK_FIELD_1'
'TEST.PK_FIELD_2'
'TEST.PK_FIELD_3')
MasterSearchFlags = [msfOpenMasterOnOpen, msfSearchAppliesToMasterOnly]
OrderingItemNo = 1
OrderingItems.Strings = ('PK_FIELD_1=PK_FIELD_1, PK_FIELD_2,
PK_FIELD_3')
OrderingLinks.Strings = ('PK_FIELD_1=ITEM=1')
RequestLive = True
BufferSynchroFlags = []
FetchWholeRows = False
Left = 9
Top = 9
end

When I do this on a speedbutton click:

IB_Query7.Locate('POSTAL_CODE;', '21', []);
Label1.Caption := 'First Locate';
Application.ProcessMessages;

IB_Query7.Locate('POSTAL_CODE;', '214', []);
Label1.Caption := 'Second Locate';
Application.ProcessMessages;

IB_Query7.Locate('POSTAL_CODE;', '21424', []);
Label1.Caption := 'Third Locate';
Application.ProcessMessages;

IB_Query7.Locate('POSTAL_CODE;', '214', []);
Label1.Caption := 'Fourth Locate';
Application.ProcessMessages;

The Fourth locate takes ages! That record is at approx. position 3800. In
TIB_BDataset.IMP there's this row at line 1322 (4.2Ia):

BufferRowNum := ii; // Beware of fetch callbacks. FetchingAborted
too.

and it seems it's passed thousands of times for the fourth locate to
complete creating intense network activity. Why is locate 1, 2, 3 so fast
when locate 4 takes minutes to complete over a 5 kbit line? Running cpLocal,
though, one only notices a sligt pause,

PK_FIELD_1 is populated with numbers and all fields are filled with 5 digits
in all records. No localized characters.

If I use LookupKeyForFields it's lightning fast but I have to supply values
for all 3 fields, and that's not suitable in the context of what I'm trying
to do. Neither do I want to filter or limit the rows in the dataset.

Thankt a lot!

/Dany