The steps for transaction

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
wahono
Junior Boarder
Junior Boarder
Posts: 32
Joined: 30.07.2007, 16:20
Location: Indonesia
Contact:

The steps for transaction

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

Post 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
Image
gto
Zeos Dev Team
Zeos Dev Team
Posts: 278
Joined: 11.11.2005, 18:35
Location: Porto Alegre / Brasil

Post 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 ;)
Use the FU!!!!!IN Google !

gto's Zeos Quick Start Guide

Te Amo Taís!
wahono
Junior Boarder
Junior Boarder
Posts: 32
Joined: 30.07.2007, 16:20
Location: Indonesia
Contact:

Post by wahono »

All steps without error message, here is the test project.
You do not have the required permissions to view the files attached to this post.
wahono
Junior Boarder
Junior Boarder
Posts: 32
Joined: 30.07.2007, 16:20
Location: Indonesia
Contact:

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

Post 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
Image
wahono
Junior Boarder
Junior Boarder
Posts: 32
Joined: 30.07.2007, 16:20
Location: Indonesia
Contact:

Post 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
wahono
Junior Boarder
Junior Boarder
Posts: 32
Joined: 30.07.2007, 16:20
Location: Indonesia
Contact:

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