diff options
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index e093a822303..0ee351ec970 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4224,7 +4224,6 @@ option_value: { THD* thd= YYTHD; LEX *lex= &thd->lex; - system_variables vars= thd->variables; CHARSET_INFO *cs= $2 ? $2 : thd->db_charset; CHARSET_INFO *cl= $3 ? $3 : cs; @@ -4241,6 +4240,35 @@ option_value: find_sys_var("client_collation"), csname)); } + | COLLATION_SYM collation_name_or_default + { + THD* thd= YYTHD; + LEX *lex= &thd->lex; + system_variables *vars= &thd->variables; + CHARSET_INFO *cs= vars->thd_charset; + CHARSET_INFO *cl= $2; + + if (!cl) + { + if (!(cl=get_charset_by_csname(cs->csname,MY_CS_PRIMARY,MYF(0)))) + { + net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,"DEFAULT"); + YYABORT; + } + } + else if ((cl != cs) && strcmp(cs->csname,cl->csname)) + { + net_printf(YYTHD,ER_COLLATION_CHARSET_MISMATCH, + cl->name,cs->csname); + YYABORT; + } + Item_string *csname= new Item_string(cl->name, + strlen(cl->name), + &my_charset_latin1); + lex->var_list.push_back(new set_var(lex->option_type, + find_sys_var("client_collation"), + csname)); + } | PASSWORD equal text_or_password { THD *thd=YYTHD; |