Browse Source

* 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 -

reiniero 12 years ago
parent
commit
4556129de7
1 changed files with 6 additions and 2 deletions
  1. 6 2
      packages/fcl-db/src/dbase/dbf.pas

+ 6 - 2
packages/fcl-db/src/dbase/dbf.pas

@@ -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;