|
@@ -2066,45 +2066,49 @@ var
|
|
|
lIndexDef: TDbfIndexDef;
|
|
|
lIndexFile, lSaveIndexFile: TIndexFile;
|
|
|
begin
|
|
|
- lCursor := nil;
|
|
|
- lSaveCursor := nil;
|
|
|
- lIndexFile := nil;
|
|
|
- lSaveIndexFile := FIndexFile;
|
|
|
- if (FCursor is TIndexCursor)
|
|
|
- and (TIndexCursor(FCursor).IndexFile.Expression = KeyFields) then
|
|
|
+ if not (loCaseInsensitive in Options) then
|
|
|
begin
|
|
|
- lCursor := FCursor;
|
|
|
- end else begin
|
|
|
- lIndexDef := FIndexDefs.GetIndexByField(KeyFields);
|
|
|
- if lIndexDef <> nil then
|
|
|
+ lCursor := nil;
|
|
|
+ lSaveCursor := nil;
|
|
|
+ lIndexFile := nil;
|
|
|
+ lSaveIndexFile := FIndexFile;
|
|
|
+ if (FCursor is TIndexCursor)
|
|
|
+ and (TIndexCursor(FCursor).IndexFile.Expression = KeyFields) then
|
|
|
begin
|
|
|
- lIndexName := ParseIndexName(lIndexDef.IndexFile);
|
|
|
- lIndexFile := FDbfFile.GetIndexByName(lIndexName);
|
|
|
- if lIndexFile <> nil then
|
|
|
+ lCursor := FCursor;
|
|
|
+ end else begin
|
|
|
+ lIndexDef := FIndexDefs.GetIndexByField(KeyFields);
|
|
|
+ if lIndexDef <> nil then
|
|
|
begin
|
|
|
- lSaveCursor := FCursor;
|
|
|
- lCursor := TIndexCursor.Create(lIndexFile);
|
|
|
- lSaveIndexName := lIndexFile.IndexName;
|
|
|
- lIndexFile.IndexName := lIndexName;
|
|
|
- FIndexFile := lIndexFile;
|
|
|
+ lIndexName := ParseIndexName(lIndexDef.IndexFile);
|
|
|
+ lIndexFile := FDbfFile.GetIndexByName(lIndexName);
|
|
|
+ if lIndexFile <> nil then
|
|
|
+ begin
|
|
|
+ lSaveCursor := FCursor;
|
|
|
+ lCursor := TIndexCursor.Create(lIndexFile);
|
|
|
+ lSaveIndexName := lIndexFile.IndexName;
|
|
|
+ lIndexFile.IndexName := lIndexName;
|
|
|
+ FIndexFile := lIndexFile;
|
|
|
+ end;
|
|
|
end;
|
|
|
end;
|
|
|
- end;
|
|
|
- if lCursor <> nil then
|
|
|
- begin
|
|
|
- FCursor := lCursor;
|
|
|
- Result := LocateRecordIndex(KeyFields, KeyValues, Options);
|
|
|
- if lSaveCursor <> nil then
|
|
|
- begin
|
|
|
- FCursor.Free;
|
|
|
- FCursor := lSaveCursor;
|
|
|
- end;
|
|
|
- if lIndexFile <> nil then
|
|
|
+ if lCursor <> nil then
|
|
|
begin
|
|
|
- FLocateRecNo := FIndexFile.PhysicalRecNo;
|
|
|
- lIndexFile.IndexName := lSaveIndexName;
|
|
|
- FIndexFile := lSaveIndexFile;
|
|
|
- end;
|
|
|
+ FCursor := lCursor;
|
|
|
+ Result := LocateRecordIndex(KeyFields, KeyValues, Options);
|
|
|
+ if lSaveCursor <> nil then
|
|
|
+ begin
|
|
|
+ FCursor.Free;
|
|
|
+ FCursor := lSaveCursor;
|
|
|
+ end;
|
|
|
+ if lIndexFile <> nil then
|
|
|
+ begin
|
|
|
+ FLocateRecNo := FIndexFile.PhysicalRecNo;
|
|
|
+ lIndexFile.IndexName := lSaveIndexName;
|
|
|
+ FIndexFile := lSaveIndexFile;
|
|
|
+ end;
|
|
|
+ end else
|
|
|
+ Result := LocateRecordLinear(KeyFields, KeyValues, Options);
|
|
|
end else
|
|
|
Result := LocateRecordLinear(KeyFields, KeyValues, Options);
|
|
|
end;
|