1630
bool sys_var_character_set::check(Session *, set_var *var)
1632
const CHARSET_INFO *tmp;
1634
if (var->value->result_type() == STRING_RESULT)
1636
char buff[STRING_BUFFER_USUAL_SIZE];
1637
String str(buff,sizeof(buff), system_charset_info), *res;
1638
if (!(res=var->value->val_str(&str)))
1642
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL");
1647
else if (!(tmp= get_charset_by_csname(res->c_ptr(),MY_CS_PRIMARY,MYF(0))))
1649
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), res->c_ptr());
1655
if (!(tmp=get_charset((int) var->value->val_int(),MYF(0))))
1658
int10_to_str((int) var->value->val_int(), buf, -10);
1659
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), buf);
1663
var->save_result.charset= tmp; // Save for update
1668
bool sys_var_character_set::update(Session *session, set_var *var)
1670
ci_ptr(session,var->type)[0]= var->save_result.charset;
1671
session->update_charset();
1676
unsigned char *sys_var_character_set::value_ptr(Session *session,
1680
const CHARSET_INFO * const cs= ci_ptr(session,type)[0];
1681
return cs ? (unsigned char*) cs->csname : (unsigned char*) NULL;
1685
1630
bool sys_var_collation_sv::update(Session *session, set_var *var)
1687
1632
if (var->type == OPT_GLOBAL)
1953
/*****************************************************************************
1954
Functions to handle SET NAMES and SET CHARACTER SET
1955
*****************************************************************************/
1957
int set_var_collation_client::check(Session *)
1959
/* Currently, UCS-2 cannot be used as a client character set */
1960
if (character_set_client->mbminlen > 1)
1962
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "character_set_client",
1963
character_set_client->csname);
1969
int set_var_collation_client::update(Session *session)
1971
session->variables.character_set_client= character_set_client;
1972
session->variables.character_set_results= character_set_results;
1973
session->variables.collation_connection= collation_connection;
1974
session->update_charset();
1975
session->protocol_text.init(session);
1979
1897
/****************************************************************************/
1981
1899
bool sys_var_timestamp::update(Session *session, set_var *var)
2658
Say if all variables set by a SET support the ONE_SHOT keyword
2659
(currently, only character set and collation do; later timezones
2662
@param var_list List of variables to update
2665
It has a "not_" because it makes faster tests (no need to "!")
2668
0 all variables of the list support ONE_SHOT
2670
1 at least one does not support ONE_SHOT
2673
bool not_all_support_one_shot(List<set_var_base> *var_list)
2675
List_iterator_fast<set_var_base> it(*var_list);
2679
if (var->no_support_one_shot())
2686
2575
/*****************************************************************************
2687
2576
Functions to handle SET mysql_internal_variable=const_expr
2688
2577
*****************************************************************************/