RollBack and Mysql y cant make it work...

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
joker53
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 13.09.2006, 13:28

RollBack and Mysql y cant make it work...

Post by joker53 »

i Start the transaction(StartTransaction)........ make an insert, fill the fields with dbcomponents, make the post, and until there the changes are not on the database wich is ok....... if i make a Commit the changes goes to the database wich is also ok but if i make a Rollback, the changes also goes to database instead rollback the transaction.....What i´m doing wrong ????

Thank you very much....

my zconnection have autocomit to true, i tried protocol on "mysql" and "mysql-4.1" i have mysql 4.1.21
User avatar
dhongu
Junior Boarder
Junior Boarder
Posts: 37
Joined: 28.09.2005, 08:37
Location: Bucuresti
Contact:

Post by dhongu »

For transaction you most have autocomit = false, and call manually Commit and Rollback
In mysql transaction work only innodb tabele.
Dorin Hongu
joker53
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 13.09.2006, 13:28

Post by joker53 »

hi dhongu, thanks for you reply....
i tried what you said and i get an error message that said "invalid operation in non AutoCommit mode"
The table is innodb
Do you whats going on?....

thanks a lot.
joker53
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 13.09.2006, 13:28

Post by joker53 »

is ok i understood now, i got that error when i executed startTransaction... but i realize than with autocomit = false i dont need it isn it?.......i just call commit or rollback ...

Thank you very much
joker53
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 13.09.2006, 13:28

Post by joker53 »

mmmmmmmmmm i anticipate the reply before test............
if autocomit = false and i execute StartTransaction i get "invalid operation in non AutoCommit mode"
if i dont execute StartTransaction, make an insert, a post and a commit or rollback, nothing happen..........

Well....if anybody can help me i´ll appreciate.......
joker53
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 13.09.2006, 13:28

Post by joker53 »

i finally got it the problem was obvious, as usual.....
to make a transaction is needed set the attribute Transact Issolation Level .....
i made it with autocommit=true with start transaction, commit and rollback and works fine.....
User avatar
dhongu
Junior Boarder
Junior Boarder
Posts: 37
Joined: 28.09.2005, 08:37
Location: Bucuresti
Contact:

Post by dhongu »

In my code I non't use StartTransaction.
For begin transaction call function Commit.
Dorin Hongu
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

StartTransaction is used for a temporary 'escape' from autocommit mode.
You can call it when autocommit is on. After commit you're in autocommit mode again.(actually : starttransaction turns mysql autocommit off and commit re-enables it at commit while the zeos autocommit settings does not change)

It should not be necessary to start with a commit when in not-autocommit mode. The transaction will start immediately and will be closed at commit, a new transaction starts automatically thereafter.

Mark
Post Reply