Page 1 of 1

Why doesn't work a simple rollback to me (Zeos+D7+MySQL) ?

Posted: 27.01.2013, 18:06
by Carcatrepa
Hi all, I'm new to ZeosLib.

I have Delphi 7, zeoslib 6.6.6 (also tried 7.0.3) and libmysql.dll
5.5.29 working over InnoDB database.

I have a conBD1 (TZConnection) with autocommit=true and a zqry1
(TZQuery) with "INSET INTO table (id) VALUES (:id)". I do:

...
conBD1.StartTransaction;

zqry1.ParamByName('id').AsInteger := 1;
zqry1.ExecSQL;
zqry1.ParamByName('id').AsInteger := 2;
zqry1.ExecSQL;
conBD1.Commit;

conBD1.StartTransaction;

zqry1.ParamByName('id').AsInteger := 3;
zqry1.ExecSQL;
zqry1.ParamByName('id').AsInteger := 4;
zqry1.ExecSQL;
conBD1.Rollback;
...

The table has finally 4 rows when i expect 2 because the last rollback.
What am I doing wrong ?

Regards

Posted: 30.01.2013, 21:48
by mdaems
Did you try attaching a ZSQLMonitor to your project to see the exact SQL that's executed? That could maybe reveal what's happening behind the scene.