TBuFDataset.Locate : TLocateOptions
Original Reporter info from Mantis: jsund
-
Reporter name: john
Original Reporter info from Mantis: jsund
- Reporter name: john
Description:
TBuFDataset.Locate does not appear to honour the TLocateOptions passed to it. I have tested this in practice using the TSQLQuery component.
Steps to reproduce:
With any dataset descended from TBuFDataset, attempt a locate that requires loPartialKey and/or loCaseInsensitive to succeed.
Additional information:
I have tested this in practice using the TSQLQuery component, which does not seem to override TBuFDataset.Locate. Looking at the code, TDBCompareRec has a field for the options, but I can't see that it is set. TDBCompareRec is set by:
TBufDataset.ProcessFieldCompareStruct(AField: TField; var ACompareRec : TDBCompareRec);
Presumably this needs to have the options passed as an additional parameter, (or a separate step done).
If they were set in TDBCompareRec, DBCompareText seems to honour loCaseInsensitive, but takes no notice of loPartialKey.
function DBCompareText(subValue, aValue: pointer; options: TLocateOptions): LargeInt;
begin
if loCaseInsensitive in options then
Result := AnsiCompareText(pchar(subValue),pchar(aValue))
else
Result := AnsiCompareStr(pchar(subValue),pchar(aValue));
end;
Presumably, for loPartialKey to work, this would need to have some method of limiting the number of chars compared to the number in the search string.
Although I have tested this in the above mentioned release, I have also looked at the code in a relatively recent svn checkout, and it seems the same. I could possibly concoct some sort of kludge to fix this, but I don't think I know my way round the code well enough to find the "proper" solution.
Mantis conversion info:
- Mantis ID: 17684
- OS: Win
- OS Build: XP SP3 +
- Build: Release
- Platform: i386
- Version: 2.2.4