diff options
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index cf17d38566d..de89983bc51 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1084,7 +1084,7 @@ create: bzero((char*) &lex->create_info,sizeof(lex->create_info)); lex->create_info.options=$2 | $4; lex->create_info.db_type= (enum db_type) lex->thd->variables.table_type; - lex->create_info.default_table_charset= thd->variables.collation_database; + lex->create_info.default_table_charset= NULL; lex->name=0; } create2 @@ -2882,7 +2882,7 @@ alter: lex->select_lex.db=lex->name=0; bzero((char*) &lex->create_info,sizeof(lex->create_info)); lex->create_info.db_type= DB_TYPE_DEFAULT; - lex->create_info.default_table_charset= thd->variables.collation_database; + lex->create_info.default_table_charset= NULL; lex->create_info.row_type= ROW_TYPE_NOT_USED; lex->alter_info.reset(); lex->alter_info.is_simple= 1; @@ -5704,7 +5704,9 @@ opt_db: wild: /* empty */ - | LIKE text_string { Lex->wild= $2; }; + | LIKE TEXT_STRING_sys + { Lex->wild= new (&YYTHD->mem_root) String($2.str, $2.length, + system_charset_info); }; opt_full: /* empty */ { Lex->verbose=0; } @@ -6202,7 +6204,19 @@ IDENT_sys: { THD *thd= YYTHD; if (thd->charset_is_system_charset) + { + CHARSET_INFO *cs= system_charset_info; + uint wlen= cs->cset->well_formed_len(cs, $1.str, + $1.str+$1.length, + $1.length); + if (wlen < $1.length) + { + net_printf(YYTHD, ER_INVALID_CHARACTER_STRING, cs->csname, + $1.str + wlen); + YYABORT; + } $$= $1; + } else thd->convert_string(&$$, system_charset_info, $1.str, $1.length, thd->charset()); |