Board index » delphi » Bug in TTable.Locate using search option loPartialKey

Bug in TTable.Locate using search option loPartialKey

When I do searches with TTable.Locate using search option
[loPartialKey],
TTable.Locate sometimes doesn't find rows in the table e.g.
I have rows in my SearchTable with the following content in the column
SearchColumn:

row 1: AB-XYZ
row 2: ABB-XYZ
row 3: ABF
 .
 .
row i: BLA
 .
 .

Then the following calls are executed successively:

1. SearchTable.Locate(SearchColumn,'ABF',[])
2. SearchTable.Locate(SearchColumn,'AB',[loPartialKey])
3. SearchTable.Locate(SearchColumn,'ABB',[loPartialKey])        

Statements 1 and 2 are succesful, statement 3 fails (the call returns
false).
If after statement 3 a call to Locate like in statement 4 or 5 is made,
another
execution of statement 3 is succesful.

4. SearchTable.Locate(SearchColumn,'BLA',[loPartialKey])
5. SearchTable.Locate(SearchColumn,'CNIT',[loPartialKey]) ('CNIT' is not
a table content).

If after execution of statement 3 a call to Locate like in statement 6
is made,
I get a EDBEngine exception (BDE errorcode: DBIERR_NOCURRREC).

6. SearchTable.Locate(SearchColumn,'BLA',[])

Has anyone else noticed this behaviour of TTable.Locate?
Are there workarounds?

Regards,
        Riccardo Foschia

 

Re:Bug in TTable.Locate using search option loPartialKey


Try setting your current table record position back to the start
(.first) between the calls
as, if this was not being done,  this would explain the first part of
your description.

J.Willis
101775.1...@compuserve.com

Quote
Riccardo Foschia wrote:
> When I do searches with TTable.Locate using search option
> [loPartialKey],
> TTable.Locate sometimes doesn't find rows in the table e.g.
> I have rows in my SearchTable with the following content in the column

> SearchColumn:

> row 1: AB-XYZ
> row 2: ABB-XYZ
> row 3: ABF
>  .
>  .
> row i: BLA
>  .
>  .

> Then the following calls are executed successively:

> 1. SearchTable.Locate(SearchColumn,'ABF',[])
> 2. SearchTable.Locate(SearchColumn,'AB',[loPartialKey])
> 3. SearchTable.Locate(SearchColumn,'ABB',[loPartialKey])

> Statements 1 and 2 are succesful, statement 3 fails (the call returns
> false).
> If after statement 3 a call to Locate like in statement 4 or 5 is
> made,
> another
> execution of statement 3 is succesful.

> 4. SearchTable.Locate(SearchColumn,'BLA',[loPartialKey])
> 5. SearchTable.Locate(SearchColumn,'CNIT',[loPartialKey]) ('CNIT' is
> not
> a table content).

> If after execution of statement 3 a call to Locate like in statement 6

> is made,
> I get a EDBEngine exception (BDE errorcode: DBIERR_NOCURRREC).

> 6. SearchTable.Locate(SearchColumn,'BLA',[])

> Has anyone else noticed this behaviour of TTable.Locate?
> Are there workarounds?

> Regards,
>         Riccardo Foschia

Re:Bug in TTable.Locate using search option loPartialKey


Try setting your current table record position back to the start
(.first) between the calls
as, if this was not being done,  this would explain the first part of
your description.

J.Willis
101775.1...@compuserve.com

Quote
Riccardo Foschia wrote:
> When I do searches with TTable.Locate using search option
> [loPartialKey],
> TTable.Locate sometimes doesn't find rows in the table e.g.
> I have rows in my SearchTable with the following content in the column

> SearchColumn:

> row 1: AB-XYZ
> row 2: ABB-XYZ
> row 3: ABF
>  .
>  .
> row i: BLA
>  .
>  .

> Then the following calls are executed successively:

> 1. SearchTable.Locate(SearchColumn,'ABF',[])
> 2. SearchTable.Locate(SearchColumn,'AB',[loPartialKey])
> 3. SearchTable.Locate(SearchColumn,'ABB',[loPartialKey])

> Statements 1 and 2 are succesful, statement 3 fails (the call returns
> false).
> If after statement 3 a call to Locate like in statement 4 or 5 is
> made,
> another
> execution of statement 3 is succesful.

> 4. SearchTable.Locate(SearchColumn,'BLA',[loPartialKey])
> 5. SearchTable.Locate(SearchColumn,'CNIT',[loPartialKey]) ('CNIT' is
> not
> a table content).

> If after execution of statement 3 a call to Locate like in statement 6

> is made,
> I get a EDBEngine exception (BDE errorcode: DBIERR_NOCURRREC).

> 6. SearchTable.Locate(SearchColumn,'BLA',[])

> Has anyone else noticed this behaviour of TTable.Locate?
> Are there workarounds?

> Regards,
>         Riccardo Foschia

Other Threads