Commit 31e52b16 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

Optimize charset tracking a bit.

parent 517d7182
......@@ -1016,24 +1016,12 @@ int set_var_collation_client::update(THD *thd)
#ifndef EMBEDDED_LIBRARY
if (thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)->is_enabled())
{
sys_var *svar;
mysql_mutex_lock(&LOCK_plugin);
if ((svar= find_sys_var_ex(thd, "character_set_client",
sizeof("character_set_client") - 1,
false, true)))
thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)->
mark_as_changed(thd, (LEX_CSTRING*)svar);
if ((svar= find_sys_var_ex(thd, "character_set_results",
sizeof("character_set_results") - 1,
false, true)))
mark_as_changed(thd, (LEX_CSTRING*)Sys_character_set_client_ptr);
thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)->
mark_as_changed(thd, (LEX_CSTRING*)svar);
if ((svar= find_sys_var_ex(thd, "character_set_connection",
sizeof("character_set_connection") - 1,
false, true)))
mark_as_changed(thd, (LEX_CSTRING*)Sys_character_set_results_ptr);
thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)->
mark_as_changed(thd, (LEX_CSTRING*)svar);
mysql_mutex_unlock(&LOCK_plugin);
mark_as_changed(thd, (LEX_CSTRING*)Sys_character_set_connection_ptr);
}
thd->session_tracker.mark_as_changed(thd, SESSION_STATE_CHANGE_TRACKER, NULL);
#endif //EMBEDDED_LIBRARY
......
......@@ -430,7 +430,9 @@ sql_mode_t expand_sql_mode(sql_mode_t sql_mode);
bool sql_mode_string_representation(THD *thd, sql_mode_t sql_mode, LEX_STRING *ls);
int default_regex_flags_pcre(const THD *thd);
extern sys_var *Sys_autocommit_ptr, *Sys_last_gtid_ptr;
extern sys_var *Sys_autocommit_ptr, *Sys_last_gtid_ptr,
*Sys_character_set_client_ptr, *Sys_character_set_connection_ptr,
*Sys_character_set_results_ptr;
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
......
......@@ -673,6 +673,8 @@ static Sys_var_struct Sys_character_set_client(
offsetof(CHARSET_INFO, csname), DEFAULT(&default_charset_info),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_cs_client),
ON_UPDATE(fix_thd_charset));
// for check changing
export sys_var *Sys_character_set_client_ptr= &Sys_character_set_client;
static Sys_var_struct Sys_character_set_connection(
"character_set_connection", "The character set used for "
......@@ -682,6 +684,8 @@ static Sys_var_struct Sys_character_set_connection(
offsetof(CHARSET_INFO, csname), DEFAULT(&default_charset_info),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_charset_not_null),
ON_UPDATE(fix_thd_charset));
// for check changing
export sys_var *Sys_character_set_connection_ptr= &Sys_character_set_connection;
static Sys_var_struct Sys_character_set_results(
"character_set_results", "The character set used for returning "
......@@ -689,6 +693,8 @@ static Sys_var_struct Sys_character_set_results(
SESSION_VAR(character_set_results), NO_CMD_LINE,
offsetof(CHARSET_INFO, csname), DEFAULT(&default_charset_info),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_charset));
// for check changing
export sys_var *Sys_character_set_results_ptr= &Sys_character_set_results;
static Sys_var_struct Sys_character_set_filesystem(
"character_set_filesystem", "The filesystem character set",
......
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