Subject | TIBOTable.Locate problem |
---|---|
Author | remk_1 |
Post date | 2003-03-14T11:09:07Z |
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
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