diff options
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 68680addc58..44667a425fe 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -9931,11 +9931,19 @@ literal: String *str= tmp ? tmp->quick_fix_field(), tmp->val_str((String*) 0) : (String*) 0; - $$= new Item_string(str ? str->ptr() : "", + $$= new Item_string(NULL, /* name will be set in select_item */ + str ? str->ptr() : "", str ? str->length() : 0, $1); if ($$) + { ((Item_string *) $$)->set_repertoire_from_value(); + if (!$$->check_well_formed_result(&$$->str_value)) + { + $$= new Item_null(); + $$->set_name(NULL, 0, system_charset_info); + } + } } | UNDERSCORE_CHARSET BIN_NUM { @@ -9947,14 +9955,19 @@ literal: String *str= tmp ? tmp->quick_fix_field(), tmp->val_str((String*) 0) : (String*) 0; - $$= new Item_string(str ? str->ptr() : "", + $$= new Item_string(NULL, /* name will be set in select_item */ + str ? str->ptr() : "", str ? str->length() : 0, - Lex->charset); + Lex->underscore_charset); + if ($$ && !$$->check_well_formed_result(&$$->str_value)) + { + $$= new Item_null(); + $$->set_name(NULL, 0, system_charset_info); + } } - | DATE_SYM text_literal { $$ = $2; } - | TIME_SYM text_literal { $$ = $2; } - | TIMESTAMP text_literal { $$ = $2; } - ; + | DATE_SYM text_literal { $$ = $2; } + | TIME_SYM text_literal { $$ = $2; } + | TIMESTAMP text_literal { $$ = $2; }; NUM_literal: NUM |