tidb: add enum type test

This commit is contained in:
siddontang
2015-09-24 10:57:48 +08:00
parent 4a6cf4d7b8
commit 59ae05b797

View File

@ -894,6 +894,24 @@ func (s *testSessionSuite) TestBootstrap(c *C) {
mustExecSQL(c, se, "USE test;")
}
func (s *testSessionSuite) TestEnum(c *C) {
store := newStore(c, s.dbName)
se := newSession(c, store, s.dbName)
mustExecSQL(c, se, "drop table if exists t")
mustExecSQL(c, se, "create table t (c enum('a', 'b', 'c'))")
mustExecSQL(c, se, "insert into t values ('a'), (2), ('c')")
r := mustExecSQL(c, se, "select * from t where c = 'a'")
row, err := r.FirstRow()
c.Assert(err, IsNil)
match(c, row, "a")
r = mustExecSQL(c, se, "select c + 1 from t where c = 2")
row, err = r.FirstRow()
c.Assert(err, IsNil)
match(c, row, "3")
}
func newSession(c *C, store kv.Storage, dbName string) Session {
se, err := CreateSession(store)
c.Assert(err, IsNil)