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

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
Carcatrepa
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 27.01.2013, 17:49

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

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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.
Image
Post Reply