I want to commit manually.How can i do that not auto commit the transaction.I want to test the mysql transaction and isolation like:
begin;
select count(*) from beiker_region_property
where id=10100100 for update;
commit;
thanks
How to cancel auto commit?
1) try set @@autocommit = 0;
2) what server version are you using ?
3) you know that autocommit has an effect only if the storage engine used for your table(s) supports transactions ? InnoDB does (as well as ndbcluster, PBXT, SolidDB); MyISAM does NOT, so setting autocommit (or anything else) will not have an effect with MyISAM.
2) what server version are you using ?
3) you know that autocommit has an effect only if the storage engine used for your table(s) supports transactions ? InnoDB does (as well as ndbcluster, PBXT, SolidDB); MyISAM does NOT, so setting autocommit (or anything else) will not have an effect with MyISAM.
@kalvaro i tried your solution,not work.
1.
and then run above in another query tab
2.
In the second query,i get the query result immediately,but i did not run commit command.
1.
start transaction;
select count(*) from beiker_region_property
where id=10100100 for update;
and then run above in another query tab
2.
start transaction;
select count(*) from beiker_region_property
where id=10100100 for update;
In the second query,i get the query result immediately,but i did not run commit command.
Er, you cannot nest transactions in MySQL. If you attempt to start a new one, MySQL will make an implicit commit. Whatever, the
SET @@session.autocommit = 0;
tecnique jfalch explained should do the trick, if you are using InnoDB tables. There's no way to get transactions with MyISAM!
Please login to leave a reply, or register at first.