TZQuery update adding where clause to sql statement
Posted: 31.12.2011, 18:05
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"
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"