Skip to content

Commit

Permalink
address comment and fix nil pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
tangenta committed Dec 31, 2021
1 parent 39cd5d1 commit 41b5313
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions ddl/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func TestDefaultValueIsBinaryString(t *testing.T) {
result string
}{
{"char(10) charset gbk", "0xC4E3BAC3", "你好"},
{"char(10) charset gbk", "'好'", "好"},
{"varchar(10) charset gbk", "0xC4E3BAC3", "你好"},
{"char(10) charset utf8mb4", "0xE4BDA0E5A5BD", "你好"},
{"char(10) charset utf8mb4", "0b111001001011100010010110111001111001010110001100", "世界"},
Expand Down
3 changes: 3 additions & 0 deletions types/datum.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ func (d *Datum) GetStringWithCheck(sc *stmtctx.StatementContext, chs string) (st

func findEncoding(sc *stmtctx.StatementContext, chs string) (enc charset.Encoding, skip bool) {
enc = charset.FindEncoding(chs)
if sc == nil {
return enc, false
}
if enc.Tp() == charset.EncodingTpUTF8 && sc.SkipUTF8Check ||
enc.Tp() == charset.EncodingTpASCII && sc.SkipASCIICheck {
return nil, true
Expand Down

0 comments on commit 41b5313

Please sign in to comment.