tidb: update format

This commit is contained in:
xia
2015-09-16 10:55:06 +08:00
parent 53d22bf30f
commit 2f76e52c8f

View File

@ -477,23 +477,19 @@ func checkAutocommit(c *C, se Session, stmt string, isNil, expect bool) {
func (s *testSessionSuite) TestAutocommit(c *C) {
store := newStore(c, s.dbName)
se := newSession(c, store, s.dbName)
mustExecSQL(c, se, "drop table if exists t")
c.Assert(se.(*session).txn, IsNil)
checkAutocommit(c, se, "drop table if exists t", true, false)
checkAutocommit(c, se, "create table t (id BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL)", true, false)
checkAutocommit(c, se, "insert t values ()", true, false)
checkAutocommit(c, se, "begin", false, true)
checkAutocommit(c, se, "insert t values ()", false, true)
se.Execute("drop table if exists t;")
c.Assert(se.(*session).txn, IsNil)
c.Assert(variable.GetSessionVars(se.(*session)).DisableAutocommit, IsTrue)
checkAutocommit(c, se, "drop table if exists t;", true, true)
checkAutocommit(c, se, "create table t (id BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL)", true, true)
checkAutocommit(c, se, "insert t values ()", false, true)
checkAutocommit(c, se, "commit", true, false)
checkAutocommit(c, se, "insert t values ()", true, false)
se.Execute("drop table if exists t;")
mustExecSQL(c, se, "create table t (id BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL)")
c.Assert(variable.GetSessionVars(se.(*session)).DisableAutocommit, IsFalse)
checkAutocommit(c, se, "drop table if exists t;", true, false)
checkAutocommit(c, se, "create table t (id BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL)", true, false)
checkAutocommit(c, se, "begin", false, true)
checkAutocommit(c, se, "insert t values ()", false, true)
checkAutocommit(c, se, "rollback", true, false)