I am new to MySql and Zeos, I have a app thet connects to a MySql Database and everything works fine except some of the functions are very slow as I use a ztable.locate command to find records.
What I need is to know is what is the equivalent of the TTable.Indexname and TTable.Findkey Command with the zeos library ? (Have searched but really need help now)
Index Help Neede
Moderators: gto, cipto_kh, EgonHugeist
- Sergiomaster
- Fresh Boarder
- Posts: 24
- Joined: 13.06.2011, 12:37
Re: Index Help Neede
Hello,
Findkey is a 'bad habit IMO , findkey is looking in the loaded dataset (that was great with a paradox table, loaded in memory , but not for a table in a SGBD overall if not local)
Use a ZQuery (or TZReadOnlyQuery) with a select containing a where clause .
i.e
Where N is a parameter and IDNUMBER is one of the Index (not necessary but better) primary or not , unique (preferably or not)
usage
Findkey is a 'bad habit IMO , findkey is looking in the loaded dataset (that was great with a paradox table, loaded in memory , but not for a table in a SGBD overall if not local)
Use a ZQuery (or TZReadOnlyQuery) with a select containing a where clause .
i.e
Code: Select all
SELECT * FROM CUSTOMERS WHERE IDNUMBER=:N
usage
Code: Select all
TZReadOnlyQuery.Active:=False;
TZReadOnlyQuery.ParambyName('N').asINteger:=100;
TZReadOnlyQuery.Active:=True;
if TZReadOnlyQuery.FieldByName('IDNUMBER').isnull
then showmessage('Not found')
else .....
Main uses Delphi3/7/2010/Rio 10.3/Sidney 10.4 + Interbase/Firebird