1# The purpose of this test is to test that setting autocommit does a 2# commit of outstanding transactions and nothing is left pending in 3# the transaction cache. 4 5source include/have_log_bin.inc; 6source include/have_innodb.inc; 7 8# We need a transactional engine, so let's use InnoDB 9CREATE TABLE t1 (id INT) ENGINE = InnoDB; 10 11# Testing SET AUTOCOMMIT 12SET BINLOG_FORMAT = STATEMENT; 13 14let $cleanup = COMMIT; 15 16let $prepare = SET AUTOCOMMIT = 0; 17let $statement = SET AUTOCOMMIT = 1; 18source include/implicit.test; 19 20let $prepare = SET AUTOCOMMIT = 1; 21let $statement = SET AUTOCOMMIT = 1; 22source include/implicit.test; 23 24let $prepare = SET AUTOCOMMIT = 0; 25let $statement = SET AUTOCOMMIT = 0; 26source include/implicit.test; 27 28let $prepare = SET AUTOCOMMIT = 1; 29let $statement = SET AUTOCOMMIT = 0; 30source include/implicit.test; 31 32SET BINLOG_FORMAT = ROW; 33let $prepare = SET AUTOCOMMIT = 0; 34let $statement = SET AUTOCOMMIT = 1; 35source include/implicit.test; 36 37let $prepare = SET AUTOCOMMIT = 1; 38let $statement = SET AUTOCOMMIT = 1; 39source include/implicit.test; 40 41let $prepare = SET AUTOCOMMIT = 0; 42let $statement = SET AUTOCOMMIT = 0; 43source include/implicit.test; 44 45let $prepare = SET AUTOCOMMIT = 1; 46let $statement = SET AUTOCOMMIT = 0; 47source include/implicit.test; 48 49RESET MASTER; 50SET AUTOCOMMIT = 0; 51INSERT INTO t1 VALUES (1); 52source include/show_binlog_events.inc; 53LOCK TABLES t1 WRITE; 54source include/show_binlog_events.inc; 55INSERT INTO t1 VALUES (2); 56source include/show_binlog_events.inc; 57UNLOCK TABLES; 58source include/show_binlog_events.inc; 59COMMIT; 60source include/show_binlog_events.inc; 61 62# Cleaning up 63DROP TABLE t1; 64