The options loCaseInsensitive and loPartialKey of the locate method in the SQLdb lazarus / 16-Databases ---------------------------------------------------------------------- BraveDOG · 2010-02-11 19:54 The options loCaseInsensitive and loPartialKey of the locate method in the SQLdb doesn't work correctly. In the KeyPress event of the object TDBGrid, typing the letter B, it is not the first word that start with that letter (eg, Bruno), but if there is one name B (only), he finds him. procedure TfrmVendedores.grdDadosKeyPress(Sender: TObject; var Key: char); begin   DM.tbVendedores.Locate('Name', key, [loCaseInsensitive,loPartialKey]); end; The database I'm using is MySQL 5. The version of Lazarus that I'm using is 0.9.29; ---------------------------------------------------------------------- LacaK · 2010-02-12 09:13 Yes as is discussed in bug report: http://bugs.freepascal.org/view.php?id=15725 There is missing implementation of this feature in fpc/.../source/packages/fcl-db/src/base/bufdataset.pas - TBufDataset.Locate method (parameter options is not used). As I wrote you have some options: 1. wait until bug is fixed and then install fixed version of Lazarus/FPC 2. work-around in your program (walk throught dataset and compare records to condition ... record by record) 3. Fix by your hands bug in source code of FPC (can/know you do it ?) 4. Ask somebody (in this forum?) to fix it and then apply patch to your installation L. ---------------------------------------------------------------------- LacaK · 2010-02-12 11:52 You can try this patch: Locate fpc/.../source/packages/fcl-db/src/base/bufdataset.pas file and change these functions : 1. function DBCompareText ... begin   if [loCaseInsensitive,loPartialKey]<=options then     Result := AnsiStrLIComp(pchar(subValue),pchar(aValue),length(pchar(subValue)))   else if loPartialKey in options then     Result := AnsiStrLComp(pchar(subValue),pchar(aValue),length(pchar(subValue)))   else if loCaseInsensitive in options then     Result := AnsiCompareText(pchar(subValue),pchar(aValue))   else     Result := AnsiCompareStr(pchar(subValue),pchar(aValue)); end; 2. Function TBufDataset.Locate ... //add lines with +     for FieldNr:=0 to FieldsAmount-1 do       +begin       ProcessFieldCompareStruct(TField(SearchFields[FieldNr]),DBCompar eStruct[FieldNr]);       +DBCompareStruct[FieldNr].Options:=options;       +end;   finally 3. in your project in Project/Compiler options in tab Paths add to Source units (first line): $(LazarusDir)\components\sqldb\;$(FPCSrcDir)\packages\fcl-db\src\base\ 4. try compile your project ... ---------------------------------------------------------------------- BraveDOG · 2010-02-12 17:58 Thank you very much. It worked perfectly. I just had to make a small correction in the path of the files. ---------------------------------------------------------------------- LacaK · 2010-02-15 06:46 I am happy!