Skip to content

Commit

Permalink
sessionctx: supports set character_set_results = null (#7353)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lingyu Song authored and jackysp committed Aug 11, 2018
1 parent 51e86a3 commit 8762592
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion executor/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ func (s *testSuite) TestSetVar(c *C) {
c.Assert(charset, Equals, "utf8")
c.Assert(collation, Equals, "utf8_bin")

tk.MustExec("set @@character_set_results = NULL")
tk.MustExec("set character_set_results = NULL")
tk.MustQuery("select @@character_set_results").Check(testkit.Rows(""))

// Test set transaction isolation level, which is equivalent to setting variable "tx_isolation".
tk.MustExec("SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED")
Expand Down
9 changes: 4 additions & 5 deletions sessionctx/variable/varsutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,11 @@ func SetSessionSystemVar(vars *SessionVars, name string, value types.Datum) erro
if sysVar == nil {
return UnknownSystemVar
}
if value.IsNull() {
return vars.deleteSystemVar(name)
}
var sVal string
sVal := ""
var err error
sVal, err = value.ToString()
if !value.IsNull() {
sVal, err = value.ToString()
}
if err != nil {
return errors.Trace(err)
}
Expand Down

0 comments on commit 8762592

Please sign in to comment.