parser: Add charset info for string literal

This commit is contained in:
Shen Li
2015-11-03 11:24:47 +08:00
parent 01dac873ba
commit a74b373a52

View File

@ -1797,6 +1797,15 @@ Literal:
| floatLit
| intLit
| stringLit
{
tp := types.NewFieldType(mysql.TypeString)
l := yylex.(*lexer)
tp.Charset, tp.Collate = l.GetCharsetInfo()
$$ = &types.DataItem{
Type: tp,
Data: $1.(string),
}
}
| "UNDERSCORE_CHARSET" stringLit
{
// See: https://dev.mysql.com/doc/refman/5.7/en/charset-literal.html