* FCL-DB: only honour lopartialkey for locate on indexed fields if field is string type.

This aligns behaviour with non-indexed locate as well as fpc bufdataset.
Partly addresses issue #23509

git-svn-id: trunk@23190 -
This commit is contained in:
reiniero 2012-12-19 13:11:47 +00:00
parent 9f60eca94f
commit 4556129de7

View File

@ -1758,7 +1758,7 @@ var
var
sCompare: String;
begin
if (Field.DataType = ftString) then
if (Field.DataType in [ftString,ftWideString]) then
begin
sCompare := VarToStr(varCompare);
if loCaseInsensitive in Options then
@ -1785,6 +1785,8 @@ var
end;
end
else
// Not a string; could be date, integer etc.
// Follow e.g. FPC bufdataset by searching for equal
Result := Field.Value = varCompare;
end;
@ -1848,7 +1850,9 @@ var
lTempBuffer: array [0..100] of Char;
acceptable, checkmatch: boolean;
begin
if loPartialKey in Options then
// Only honor loPartialKey for string types; for others, search for equal
if (loPartialKey in Options) and
(TIndexCursor(FCursor).IndexFile.KeyType='C') then
searchFlag := stGreaterEqual
else
searchFlag := stEqual;