Page 1 of 1

RollBack and Mysql y cant make it work...

Posted: 13.09.2006, 13:37
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

Posted: 13.09.2006, 14:01
by dhongu
For transaction you most have autocomit = false, and call manually Commit and Rollback
In mysql transaction work only innodb tabele.

Posted: 13.09.2006, 14:53
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.

Posted: 13.09.2006, 14:57
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

Posted: 13.09.2006, 15:16
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.......

Posted: 13.09.2006, 15:27
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.....

Posted: 13.09.2006, 18:09
by dhongu
In my code I non't use StartTransaction.
For begin transaction call function Commit.

Posted: 14.09.2006, 15:43
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