diff --git a/sql/set_var.cc b/sql/set_var.cc index d0b9a2170e4..a47fdbfb63f 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1655,6 +1655,34 @@ int set_var_password::update(THD *thd) 1 : 0); } + +/***************************************************************************** + Functions to handle SET NAMES and SET CHARACTER SET +*****************************************************************************/ + +int set_var_client_collation::check(THD *thd) +{ + return 0; +} + +int set_var_client_collation::update(THD *thd) +{ +#if 0 + if (var->type == OPT_GLOBAL) + global_system_variables.thd_charset= var->save_result.charset; + else +#endif + { + thd->variables.thd_charset= client_collation; + thd->variables.convert_result_charset= convert_result_charset; + thd->protocol_simple.init(thd); + thd->protocol_prep.init(thd); + } + return 0; +} + + + /**************************************************************************** Used templates ****************************************************************************/ diff --git a/sql/set_var.h b/sql/set_var.h index d91b6796d20..54f773d40ff 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -526,6 +526,21 @@ public: }; +/* For SET NAMES and SET CHARACTER SET */ + +class set_var_client_collation: public set_var_base +{ + CHARSET_INFO *client_collation; + my_bool convert_result_charset; +public: + set_var_client_collation(CHARSET_INFO *coll_arg ,my_bool conv_arg) + :client_collation(coll_arg), convert_result_charset(conv_arg) + {} + int check(THD *thd); + int update(THD *thd); +}; + + /* Prototypes for helper functions */ diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index cad7b521c17..05ebaf89e09 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4409,19 +4409,13 @@ option_value: 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)); + lex->var_list.push_back(new set_var_client_collation(cl,1)); } | 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 *cs= thd->variables.thd_charset; CHARSET_INFO *cl= $2; if (!cl) @@ -4438,12 +4432,7 @@ option_value: 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)); + lex->var_list.push_back(new set_var_client_collation(cl,1)); } | PASSWORD equal text_or_password {