Subject Re: [IBO] TIBOTable.Locate problem
Author Jason Wharton
This came up for someone not too long ago and they found out their
transaction isolation settings were off or that they were in a different
context (transaction).

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com

-- We may not have it all together --
-- But together we have it all --


----- Original Message -----
From: "remk_1" <remk_1@...>
To: <IBObjects@yahoogroups.com>
Sent: Friday, March 14, 2003 4:09 AM
Subject: [IBO] TIBOTable.Locate problem


> Hi,
>
> I have a problem with Locate method not finding a record which I
> believe it should find (BDE has no problem to Locate it). I'm new to
> IBO so may be I'm doing something wrong but the problem is evident
> even on a simple testing application with just one table and one
> database component:
>
> When I create a simple table like this
>
> CREATE TABLE TEST
> (
> TESTFLD CHAR(10) NOT NULL,
> CONSTRAINT TEST_PK PRIMARY KEY (TESTFLD)
> );
> CREATE DESCENDING INDEX TEST_D ON TEST(TESTFLD);
>
> and fill it with some data (for example left alligned strings
> from '1' to '1000') the Locate method of TIBOTable fails to find
> existing record.
>
> The problem disappears if I do one of the following:
> - set IBOTable.AutoFetchAll to true OR
> - set IBOTable.AllowHorizontalRefinement to false OR
> - set DefaultNoTrimming to true
>
> It also works OK if the table contains just a few records so they are
> all buffered (the locate method works on condition the searched
> record is nearby active record).
>
> In real application which I would convert from BDE, however, I can't
> use any of these workarounds and I would expect the same behaviour as
> had the BDE, which is to find the record.
>
> In the test application I use the following component settings:
>
> IBODatabase1:
> DatabaseName: DbName
> Username: sysdba
> Password: masterkey
> Protocol: cpTCP_IP
> Server: localhost
> Path: D:\TESTDB.GDB
>
> IBOTable1:
> DatabaseName: DbName
> TableName: TEST
> IndexFieldName: TESTFLD
> Keylinks: TESTFLD
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> IBOTable1.Open;
> if IBOTable1.Locate('TESTFLD', '123', []) then
> ShowMessage('Found')
> else
> ShowMessage('Not Found');
> IBOTable1.Close;
> end;
>
> What's wrong with it ?
>
> Michal