[fpc-pascal] sqldb how to find a record fast with primary key
Ludo Brands
ludo.brands at free.fr
Fri Oct 21 17:22:42 CEST 2011
> >
> > No sqldb specific answers on this one? I did some googling and also
> > searched for TPrimaryKey or LocalIndex in sqldb without
> results ... =(
>
> To my knowledge there is no fast search/locate in sqldb.
> Maybe we should have a look at Martin Schreibers' implementation.
>
> Michael.
>
You can use indices and locate with TSQLQuery as follows:
SQLQuery1.AddIndex('idx_no_art','no_art',[]);
SQLQuery1.IndexName:='idx_no_art';
SQLQuery1.Open;
...
SQLQuery1.Locate('no_art','200295',[]);
Unfortunately, Locate uses a simple linear search. Note also issue 0020514.
Ludo
More information about the fpc-pascal
mailing list