Page 1 of 1

The steps for transaction

Posted: 09.04.2008, 09:51
by wahono
I set zcon (TZConnection).autocommit=true. I try with 3 way to use transaction (database : MySQL 5.1, IDE : MSEgui, Lib Version : Last test trunk)

1. Record can append normally.

zcon.starttransaction;
zcon.executedirect('insert into salestrans (transid) values (''coba4'')');
zcon.commit;

2. Record can append normally.

zcon.autocommit:=false;
zcon.executedirect('insert into salestrans (transid) values (''coba4'')');
zcon.autocommit:=true;

3. Record can't append.

zcon.autocommit:=false;
zcon.executedirect('insert into salestrans (transid) values (''coba4'')');
zcon.commit;

4. Record can't rollback.

zcon.starttransaction;
zcon.executedirect('insert into salestrans (transid) values (''coba4'')');
zcon.rollback;

5. Record can rollback.

zcon.autocommit:=false;
zcon.executedirect('insert into salestrans (transid) values (''coba4'')');
zcon.rollback;

Than I am confusing about these steps, is it bug of transaction?

wahono

Posted: 09.04.2008, 10:32
by mdaems
What are the zeoslib messages when using approaches 3 and 4?
Can you drop a small project using the 5 approaches behind 5 buttons? Having a 6th button cleaning the table would be a nice extra :D
Don't forget to add a table creation script. What storage engine are you using?

Mark

Posted: 09.04.2008, 12:42
by gto
IMHO, TZConnection.ExecuteDirect seems like a function, which by the way, works very well, that would not respect the transactions.

But if it came to support , no problem ;)

Posted: 09.04.2008, 17:37
by wahono
All steps without error message, here is the test project.

Posted: 09.04.2008, 17:42
by wahono
When you try execute one of steps, than you click show data, it seems all of these steps is right. But you should close form and connect database again to see this effect.

Posted: 09.04.2008, 21:39
by mdaems
Hi,

Did first investigation. One of the involved factors seems to be the Transaction Level setting tiNone. When that setting is used Commit and Rollback are not sent to the server. (Trick to do this kind of tests : add a TZSQLMonitor to your project.)

This will involve some more study, I'm afraid.

Mark

Posted: 09.04.2008, 22:08
by wahono
gto wrote:IMHO, TZConnection.ExecuteDirect seems like a function, which by the way, works very well, that would not respect the transactions.

But if it came to support , no problem ;)
I think query that is executed from anywhere, from tzquery or from tzstatement or from tzconnection.executedirect should can process as transaction. Because transaction is from database engine.

wahono

Posted: 11.04.2008, 02:21
by wahono
mdaems wrote:Hi,

Did first investigation. One of the involved factors seems to be the Transaction Level setting tiNone. When that setting is used Commit and Rollback are not sent to the server. (Trick to do this kind of tests : add a TZSQLMonitor to your project.)

This will involve some more study, I'm afraid.
Mark
You are right, IMHO needs message if we use starttransaction, commit and rollback and transaction level is none or database server isn't support transaction.

Thanks,
wahono