mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-22 17:29:46 +02:00
* 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:
parent
9f60eca94f
commit
4556129de7
@ -1758,7 +1758,7 @@ var
|
|||||||
var
|
var
|
||||||
sCompare: String;
|
sCompare: String;
|
||||||
begin
|
begin
|
||||||
if (Field.DataType = ftString) then
|
if (Field.DataType in [ftString,ftWideString]) then
|
||||||
begin
|
begin
|
||||||
sCompare := VarToStr(varCompare);
|
sCompare := VarToStr(varCompare);
|
||||||
if loCaseInsensitive in Options then
|
if loCaseInsensitive in Options then
|
||||||
@ -1785,6 +1785,8 @@ var
|
|||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
// Not a string; could be date, integer etc.
|
||||||
|
// Follow e.g. FPC bufdataset by searching for equal
|
||||||
Result := Field.Value = varCompare;
|
Result := Field.Value = varCompare;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1848,7 +1850,9 @@ var
|
|||||||
lTempBuffer: array [0..100] of Char;
|
lTempBuffer: array [0..100] of Char;
|
||||||
acceptable, checkmatch: boolean;
|
acceptable, checkmatch: boolean;
|
||||||
begin
|
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
|
searchFlag := stGreaterEqual
|
||||||
else
|
else
|
||||||
searchFlag := stEqual;
|
searchFlag := stEqual;
|
||||||
|
Loading…
Reference in New Issue
Block a user