tidb: add enum type test
This commit is contained in:
18
tidb_test.go
18
tidb_test.go
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user