Please help. I am using zeoslib 6.6.6 Mysql & Delphi. When I try to update a database table using TZQuery object, with the following simple code, no updates happen. Upon checking the TZSQLMonitor log, I noticed that additional 'WHERE logincnt=0 AND entrydate IS NULL' clauses are being added as below.
Please does anyone know why this is and how to stop it?
Thanks
Dataconnect.GeneralQuery.SQL.Clear;
Dataconnect.GeneralQuery.SQL.Add('select logincnt, cid, entrydate from client_rw where uid = 2);
Dataconnect.GeneralQuery.Active:= True;
Dataconnect.GeneralQuery.Open;
Dataconnect.GeneralQuery.Edit;
Dataconnect.GeneralQuery.FieldValues['logincnt']:= 1;
Dataconnect.GeneralQuery.FieldValues['cid']:= 'testing';
Dataconnect.GeneralQuery.FieldByName('entrydate').AsDateTime:= Date;
Dataconnect.GeneralQuery.Post;
TZSQLMonitor Log
2011-12-31 16:38:00 cat: Execute, proto: mysql-5, msg: select logincnt, cid, entrydate from client_rw where uid = '2'
2011-12-31 16:38:00 cat: Execute, proto: mysql-5, msg: SHOW KEYS FROM securevpn_sch.client_rw
2011-12-31 16:38:00 cat: Execute, proto: mysql-5, msg: UPDATE securevpn_sch.client_rw SET logincnt=1,cid='testing',entrydate='2011-12-31' WHERE logincnt=0 AND entrydate IS NULL
2011-12-31 16:38:07 cat: Execute, proto: mysql-5, msg: select * from client_rw where uid = '2'
2011-12-31 16:38:09 cat: Disconnect, proto: mysql-5, msg: DISCONNECT FROM "securevpn_sch"
TZQuery update adding where clause to sql statement
Moderators: gto, cipto_kh, EgonHugeist
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Does your table contain a primary key and is the query property WhereMode set to wmWhereKeyOnly?
Zeoslib needs to decide the best way to select exactly the one row in the dataset you're updating. When a primary key is available that's enough for a good update, but also check if the right default Wheremode has ben set for your query.
Mark
Zeoslib needs to decide the best way to select exactly the one row in the dataset you're updating. When a primary key is available that's enough for a good update, but also check if the right default Wheremode has ben set for your query.
Mark