Board index » delphi » Locate with loPartialKey option

Locate with loPartialKey option

I just noticed a bug in Delphi's locate procedure. And as I think it has to
do with the BDE I place my question in this newsgroup.

I have seen that many others have noticed the strange behaviour as well, but
I found no solution or workaround so far.

Consider the following paradox table:
ID (alphanumeric field)
==
ab
cd

It has only two rows. Being in the first one executing the command
locate('ID', 'c', [loPartialKey]) does not find the second row.
Everything works fine when you additionally use the option loCaseInsensitive
(except of course the case-insensitivity which is not wanted in my case).

Can anyone help?
Thanks, Dominik

 

Re:Locate with loPartialKey option


I created a Paradox table with 2 rows and id field and 'ab',  'cd' data.
ocate with a ttable worked for me without loCaseInsensitive even when ID was
the primary key. Have you made sure that you have the latest version of the
BDE 5.11? The easiest way to check (for me) is the timestamp of the
idapi32.dll which should be at 5:11 AM.

http://www.borland.com/devsupport/bde/bdeupdate.html

Quote
domluebbers <domluebb...@compuserve.de> wrote in message

news:3b00df53_2@dnews...
Quote
> I just noticed a bug in Delphi's locate procedure. And as I think it has
to
> do with the BDE I place my question in this newsgroup.

> I have seen that many others have noticed the strange behaviour as well,
but
> I found no solution or workaround so far.

> Consider the following paradox table:
> ID (alphanumeric field)
> ==
> ab
> cd

> It has only two rows. Being in the first one executing the command
> locate('ID', 'c', [loPartialKey]) does not find the second row.
> Everything works fine when you additionally use the option
loCaseInsensitive
> (except of course the case-insensitivity which is not wanted in my case).

> Can anyone help?
> Thanks, Dominik

Re:Locate with loPartialKey option


OK, you're right.
But try a table that has the following rows:

ID
==
ab
C1
c2
D

Now a Locate('ID', 'c', [loPartialKey]) doesn't work. I took a look in the
Delphi VCL source code and realized that the critical point is the
DbiGetRecordForKey-call.

Any suggestions now?

Regards,
Dominik

Re:Locate with loPartialKey option


table1.locate('Id','c',[loPartialKey]); still works for me.  However looking
at your other posts,
I am using Delphi 5.1 and I think you are using 4.
Quote
domluebbers <domluebb...@compuserve.de> wrote in message

news:3b013df1_1@dnews...
Quote
> OK, you're right.
> But try a table that has the following rows:

> ID
> ==
> ab
> C1
> c2
> D

> Now a Locate('ID', 'c', [loPartialKey]) doesn't work. I took a look in the
> Delphi VCL source code and realized that the critical point is the
> DbiGetRecordForKey-call.

> Any suggestions now?

> Regards,
> Dominik

Other Threads