Commit bc1fe848 authored by mysql@home.(none)'s avatar mysql@home.(none)

sql_yacc.yy, set_var.h, set_var.cc:

  Optimization of SET NAMES
parent 6a948b83
......@@ -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
****************************************************************************/
......
......@@ -526,6 +526,21 @@ class set_var_password: public set_var_base
};
/* 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
*/
......
......@@ -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->vars->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
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment