Commit 6d5f527a authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

Variable names have been renamed:

  client_collation -> collation_client
  result_collation -> collation_results
  connection_collation -> collation_connection
parent 8379f5c4
...@@ -605,3 +605,4 @@ vio/viotest-ssl ...@@ -605,3 +605,4 @@ vio/viotest-ssl
myisam/ftbench/var/* myisam/ftbench/var/*
myisam/ftbench/data myisam/ftbench/data
myisam/ftbench/t myisam/ftbench/t
client/ssl_test
...@@ -511,59 +511,59 @@ SHOW FIELDS FROM t1; ...@@ -511,59 +511,59 @@ SHOW FIELDS FROM t1;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
latin1_f char(32) latin1_bin YES NULL latin1_f char(32) latin1_bin YES NULL
SET CHARACTER SET 'latin1'; SET CHARACTER SET 'latin1';
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
Variable_name Value Variable_name Value
client_collation latin1_swedish_ci collation_client latin1_swedish_ci
SET CHARACTER SET latin1; SET CHARACTER SET latin1;
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
Variable_name Value Variable_name Value
client_collation latin1_swedish_ci collation_client latin1_swedish_ci
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
Variable_name Value Variable_name Value
client_collation latin1_swedish_ci collation_client latin1_swedish_ci
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A' charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_swedish_ci 3 1 latin1 latin1_swedish_ci 3 1
SET CHARACTER SET latin1 COLLATE latin1_bin; SET CHARACTER SET latin1 COLLATE latin1_bin;
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
Variable_name Value Variable_name Value
client_collation latin1_bin collation_client latin1_bin
SET CHARACTER SET LATIN1 COLLATE Latin1_Bin; SET CHARACTER SET LATIN1 COLLATE Latin1_Bin;
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
Variable_name Value Variable_name Value
client_collation latin1_bin collation_client latin1_bin
SET CHARACTER SET 'latin1' COLLATE 'latin1_bin'; SET CHARACTER SET 'latin1' COLLATE 'latin1_bin';
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
Variable_name Value Variable_name Value
client_collation latin1_bin collation_client latin1_bin
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A' charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_swedish_ci 3 1 latin1 latin1_swedish_ci 3 1
SET CHARACTER SET koi8r; SET CHARACTER SET koi8r;
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
Variable_name Value Variable_name Value
client_collation koi8r_general_ci collation_client koi8r_general_ci
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A' charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_swedish_ci 3 1 latin1 latin1_swedish_ci 3 1
SET CHARACTER SET koi8r COLLATE koi8r_bin; SET CHARACTER SET koi8r COLLATE koi8r_bin;
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
Variable_name Value Variable_name Value
client_collation koi8r_bin collation_client koi8r_bin
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A' charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_swedish_ci 3 1 latin1 latin1_swedish_ci 3 1
SET CHARACTER SET koi8r COLLATE DEFAULT; SET CHARACTER SET koi8r COLLATE DEFAULT;
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
Variable_name Value Variable_name Value
client_collation koi8r_general_ci collation_client koi8r_general_ci
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A' charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_swedish_ci 3 1 latin1 latin1_swedish_ci 3 1
SET CHARACTER SET DEFAULT; SET CHARACTER SET DEFAULT;
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
Variable_name Value Variable_name Value
client_collation latin1_swedish_ci collation_client latin1_swedish_ci
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A' charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_swedish_ci 3 1 latin1 latin1_swedish_ci 3 1
......
...@@ -156,9 +156,9 @@ show variables like 'net_buffer_length'; ...@@ -156,9 +156,9 @@ show variables like 'net_buffer_length';
Variable_name Value Variable_name Value
net_buffer_length 1048576 net_buffer_length 1048576
set character set cp1251_koi8; set character set cp1251_koi8;
show variables like "client_collation"; show variables like "collation_client";
Variable_name Value Variable_name Value
client_collation cp1251_bulgarian_ci collation_client cp1251_bulgarian_ci
select @@timestamp>0; select @@timestamp>0;
@@timestamp>0 @@timestamp>0
1 1
...@@ -185,7 +185,7 @@ set SESSION query_cache_size=10000; ...@@ -185,7 +185,7 @@ set SESSION query_cache_size=10000;
Variable 'query_cache_size' is a GLOBAL variable and should be set with SET GLOBAL Variable 'query_cache_size' is a GLOBAL variable and should be set with SET GLOBAL
set GLOBAL table_type=DEFAULT; set GLOBAL table_type=DEFAULT;
Variable 'table_type' doesn't have a default value Variable 'table_type' doesn't have a default value
set client_collation=UNKNOWN_CHARACTER_SET; set collation_client=UNKNOWN_CHARACTER_SET;
Unknown character set: 'UNKNOWN_CHARACTER_SET' Unknown character set: 'UNKNOWN_CHARACTER_SET'
set global autocommit=1; set global autocommit=1;
Variable 'autocommit' is a LOCAL variable and can't be used with SET GLOBAL Variable 'autocommit' is a LOCAL variable and can't be used with SET GLOBAL
......
...@@ -128,29 +128,29 @@ SHOW CREATE TABLE t1; ...@@ -128,29 +128,29 @@ SHOW CREATE TABLE t1;
SHOW FIELDS FROM t1; SHOW FIELDS FROM t1;
SET CHARACTER SET 'latin1'; SET CHARACTER SET 'latin1';
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
SET CHARACTER SET latin1; SET CHARACTER SET latin1;
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET CHARACTER SET latin1 COLLATE latin1_bin; SET CHARACTER SET latin1 COLLATE latin1_bin;
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
SET CHARACTER SET LATIN1 COLLATE Latin1_Bin; SET CHARACTER SET LATIN1 COLLATE Latin1_Bin;
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
SET CHARACTER SET 'latin1' COLLATE 'latin1_bin'; SET CHARACTER SET 'latin1' COLLATE 'latin1_bin';
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET CHARACTER SET koi8r; SET CHARACTER SET koi8r;
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET CHARACTER SET koi8r COLLATE koi8r_bin; SET CHARACTER SET koi8r COLLATE koi8r_bin;
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET CHARACTER SET koi8r COLLATE DEFAULT; SET CHARACTER SET koi8r COLLATE DEFAULT;
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET CHARACTER SET DEFAULT; SET CHARACTER SET DEFAULT;
SHOW VARIABLES LIKE 'client_collation'; SHOW VARIABLES LIKE 'collation_client';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
--error 1251 --error 1251
SET CHARACTER SET latin1 COLLATE koi8r; SET CHARACTER SET latin1 COLLATE koi8r;
......
...@@ -92,7 +92,7 @@ set net_buffer_length=2000000000; ...@@ -92,7 +92,7 @@ set net_buffer_length=2000000000;
show variables like 'net_buffer_length'; show variables like 'net_buffer_length';
set character set cp1251_koi8; set character set cp1251_koi8;
show variables like "client_collation"; show variables like "collation_client";
select @@timestamp>0; select @@timestamp>0;
set @@rand_seed1=10000000,@@rand_seed2=1000000; set @@rand_seed1=10000000,@@rand_seed2=1000000;
...@@ -119,7 +119,7 @@ set SESSION query_cache_size=10000; ...@@ -119,7 +119,7 @@ set SESSION query_cache_size=10000;
--error 1230 --error 1230
set GLOBAL table_type=DEFAULT; set GLOBAL table_type=DEFAULT;
--error 1115 --error 1115
set client_collation=UNKNOWN_CHARACTER_SET; set collation_client=UNKNOWN_CHARACTER_SET;
--error 1228 --error 1228
set global autocommit=1; set global autocommit=1;
--error 1228 --error 1228
......
...@@ -172,7 +172,7 @@ bool Item::get_time(TIME *ltime) ...@@ -172,7 +172,7 @@ bool Item::get_time(TIME *ltime)
CHARSET_INFO * Item::default_charset() const CHARSET_INFO * Item::default_charset() const
{ {
return current_thd->variables.connection_collation; return current_thd->variables.collation_connection;
} }
bool Item::set_charset(CHARSET_INFO *cs1, enum coercion co1, bool Item::set_charset(CHARSET_INFO *cs1, enum coercion co1,
......
...@@ -2092,9 +2092,9 @@ static int init_common_variables(const char *conf_file_name, int argc, ...@@ -2092,9 +2092,9 @@ static int init_common_variables(const char *conf_file_name, int argc,
#endif #endif
if (!(default_charset_info= get_charset_by_name(sys_charset.value, MYF(MY_WME)))) if (!(default_charset_info= get_charset_by_name(sys_charset.value, MYF(MY_WME))))
return 1; return 1;
global_system_variables.result_collation= default_charset_info; global_system_variables.collation_results= default_charset_info;
global_system_variables.client_collation= default_charset_info; global_system_variables.collation_client= default_charset_info;
global_system_variables.connection_collation= default_charset_info; global_system_variables.collation_connection= default_charset_info;
charsets_list= list_charsets(MYF(MY_CS_COMPILED | MY_CS_CONFIG)); charsets_list= list_charsets(MYF(MY_CS_COMPILED | MY_CS_CONFIG));
...@@ -4575,9 +4575,9 @@ static void set_options(void) ...@@ -4575,9 +4575,9 @@ static void set_options(void)
sizeof(mysql_real_data_home)-1); sizeof(mysql_real_data_home)-1);
/* Set default values for some variables */ /* Set default values for some variables */
global_system_variables.result_collation= default_charset_info; global_system_variables.collation_results= default_charset_info;
global_system_variables.client_collation= default_charset_info; global_system_variables.collation_client= default_charset_info;
global_system_variables.connection_collation= default_charset_info; global_system_variables.collation_connection= default_charset_info;
global_system_variables.table_type= DB_TYPE_MYISAM; global_system_variables.table_type= DB_TYPE_MYISAM;
global_system_variables.tx_isolation= ISO_REPEATABLE_READ; global_system_variables.tx_isolation= ISO_REPEATABLE_READ;
global_system_variables.select_limit= (ulonglong) HA_POS_ERROR; global_system_variables.select_limit= (ulonglong) HA_POS_ERROR;
......
...@@ -724,7 +724,7 @@ bool Protocol_simple::store(const char *from, uint length, ...@@ -724,7 +724,7 @@ bool Protocol_simple::store(const char *from, uint length,
bool Protocol_simple::store(const char *from, uint length, bool Protocol_simple::store(const char *from, uint length,
CHARSET_INFO *fromcs) CHARSET_INFO *fromcs)
{ {
CHARSET_INFO *tocs= this->thd->variables.result_collation; CHARSET_INFO *tocs= this->thd->variables.collation_results;
#ifndef DEBUG_OFF #ifndef DEBUG_OFF
DBUG_ASSERT(field_types == 0 || DBUG_ASSERT(field_types == 0 ||
field_types[field_pos] == MYSQL_TYPE_DECIMAL || field_types[field_pos] == MYSQL_TYPE_DECIMAL ||
......
...@@ -105,12 +105,13 @@ sys_var_str sys_charset("character_set", ...@@ -105,12 +105,13 @@ sys_var_str sys_charset("character_set",
sys_check_charset, sys_check_charset,
sys_update_charset, sys_update_charset,
sys_set_default_charset); sys_set_default_charset);
sys_var_client_collation sys_client_collation("client_collation"); sys_var_collation_client sys_collation_client("collation_client");
sys_var_collation_connection sys_collation_connection("collation_connection");
sys_var_collation_results sys_collation_results("collation_results");
sys_var_bool_ptr sys_concurrent_insert("concurrent_insert", sys_var_bool_ptr sys_concurrent_insert("concurrent_insert",
&myisam_concurrent_insert); &myisam_concurrent_insert);
sys_var_long_ptr sys_connect_timeout("connect_timeout", sys_var_long_ptr sys_connect_timeout("connect_timeout",
&connect_timeout); &connect_timeout);
sys_var_connection_collation sys_connection_collation("connection_collation");
sys_var_enum sys_delay_key_write("delay_key_write", sys_var_enum sys_delay_key_write("delay_key_write",
&delay_key_write_options, &delay_key_write_options,
&delay_key_write_typelib, &delay_key_write_typelib,
...@@ -200,7 +201,6 @@ sys_var_thd_ulong sys_read_buff_size("read_buffer_size", ...@@ -200,7 +201,6 @@ sys_var_thd_ulong sys_read_buff_size("read_buffer_size",
&SV::read_buff_size); &SV::read_buff_size);
sys_var_thd_ulong sys_read_rnd_buff_size("read_rnd_buffer_size", sys_var_thd_ulong sys_read_rnd_buff_size("read_rnd_buffer_size",
&SV::read_rnd_buff_size); &SV::read_rnd_buff_size);
sys_var_result_collation sys_result_collation("result_collation");
sys_var_long_ptr sys_rpl_recovery_rank("rpl_recovery_rank", sys_var_long_ptr sys_rpl_recovery_rank("rpl_recovery_rank",
&rpl_recovery_rank); &rpl_recovery_rank);
sys_var_long_ptr sys_query_cache_size("query_cache_size", sys_var_long_ptr sys_query_cache_size("query_cache_size",
...@@ -343,10 +343,11 @@ sys_var *sys_variables[]= ...@@ -343,10 +343,11 @@ sys_var *sys_variables[]=
&sys_binlog_cache_size, &sys_binlog_cache_size,
&sys_buffer_results, &sys_buffer_results,
&sys_bulk_insert_buff_size, &sys_bulk_insert_buff_size,
&sys_client_collation, &sys_collation_client,
&sys_collation_connection,
&sys_collation_results,
&sys_concurrent_insert, &sys_concurrent_insert,
&sys_connect_timeout, &sys_connect_timeout,
&sys_connection_collation,
&sys_default_week_format, &sys_default_week_format,
&sys_delay_key_write, &sys_delay_key_write,
&sys_delayed_insert_limit, &sys_delayed_insert_limit,
...@@ -406,7 +407,6 @@ sys_var *sys_variables[]= ...@@ -406,7 +407,6 @@ sys_var *sys_variables[]=
&sys_rand_seed2, &sys_rand_seed2,
&sys_read_buff_size, &sys_read_buff_size,
&sys_read_rnd_buff_size, &sys_read_rnd_buff_size,
&sys_result_collation,
&sys_rpl_recovery_rank, &sys_rpl_recovery_rank,
&sys_safe_updates, &sys_safe_updates,
&sys_select_limit, &sys_select_limit,
...@@ -455,10 +455,11 @@ struct show_var_st init_vars[]= { ...@@ -455,10 +455,11 @@ struct show_var_st init_vars[]= {
{sys_bulk_insert_buff_size.name,(char*) &sys_bulk_insert_buff_size,SHOW_SYS}, {sys_bulk_insert_buff_size.name,(char*) &sys_bulk_insert_buff_size,SHOW_SYS},
{sys_charset.name, (char*) &sys_charset, SHOW_SYS}, {sys_charset.name, (char*) &sys_charset, SHOW_SYS},
{"character_sets", (char*) &charsets_list, SHOW_CHAR_PTR}, {"character_sets", (char*) &charsets_list, SHOW_CHAR_PTR},
{sys_client_collation.name, (char*) &sys_client_collation, SHOW_SYS}, {sys_collation_client.name, (char*) &sys_collation_client, SHOW_SYS},
{sys_collation_connection.name,(char*) &sys_collation_connection, SHOW_SYS},
{sys_collation_results.name, (char*) &sys_collation_results, SHOW_SYS},
{sys_concurrent_insert.name,(char*) &sys_concurrent_insert, SHOW_SYS}, {sys_concurrent_insert.name,(char*) &sys_concurrent_insert, SHOW_SYS},
{sys_connect_timeout.name, (char*) &sys_connect_timeout, SHOW_SYS}, {sys_connect_timeout.name, (char*) &sys_connect_timeout, SHOW_SYS},
{sys_connection_collation.name,(char*) &sys_connection_collation, SHOW_SYS},
{"datadir", mysql_real_data_home, SHOW_CHAR}, {"datadir", mysql_real_data_home, SHOW_CHAR},
{"default_week_format", (char*) &sys_default_week_format, SHOW_SYS}, {"default_week_format", (char*) &sys_default_week_format, SHOW_SYS},
{sys_delay_key_write.name, (char*) &sys_delay_key_write, SHOW_SYS}, {sys_delay_key_write.name, (char*) &sys_delay_key_write, SHOW_SYS},
...@@ -562,7 +563,6 @@ struct show_var_st init_vars[]= { ...@@ -562,7 +563,6 @@ struct show_var_st init_vars[]= {
{sys_pseudo_thread_id.name, (char*) &sys_pseudo_thread_id, SHOW_SYS}, {sys_pseudo_thread_id.name, (char*) &sys_pseudo_thread_id, SHOW_SYS},
{sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS}, {sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS},
{sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS}, {sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS},
{sys_result_collation.name, (char*) &sys_result_collation, SHOW_SYS},
{sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS}, {sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS},
#ifdef HAVE_QUERY_CACHE #ifdef HAVE_QUERY_CACHE
{sys_query_cache_limit.name,(char*) &sys_query_cache_limit, SHOW_SYS}, {sys_query_cache_limit.name,(char*) &sys_query_cache_limit, SHOW_SYS},
...@@ -1210,86 +1210,86 @@ bool sys_var_collation::check(THD *thd, set_var *var) ...@@ -1210,86 +1210,86 @@ bool sys_var_collation::check(THD *thd, set_var *var)
return 0; return 0;
} }
bool sys_var_client_collation::update(THD *thd, set_var *var) bool sys_var_collation_client::update(THD *thd, set_var *var)
{ {
if (var->type == OPT_GLOBAL) if (var->type == OPT_GLOBAL)
global_system_variables.client_collation= var->save_result.charset; global_system_variables.collation_client= var->save_result.charset;
else else
{ {
thd->variables.client_collation= var->save_result.charset; thd->variables.collation_client= var->save_result.charset;
thd->protocol_simple.init(thd); thd->protocol_simple.init(thd);
thd->protocol_prep.init(thd); thd->protocol_prep.init(thd);
} }
return 0; return 0;
} }
byte *sys_var_client_collation::value_ptr(THD *thd, enum_var_type type) byte *sys_var_collation_client::value_ptr(THD *thd, enum_var_type type)
{ {
CHARSET_INFO *cs= ((type == OPT_GLOBAL) ? CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
global_system_variables.client_collation : global_system_variables.collation_client :
thd->variables.client_collation); thd->variables.collation_client);
return cs ? (byte*) cs->name : (byte*) ""; return cs ? (byte*) cs->name : (byte*) "";
} }
void sys_var_client_collation::set_default(THD *thd, enum_var_type type) void sys_var_collation_client::set_default(THD *thd, enum_var_type type)
{ {
if (type == OPT_GLOBAL) if (type == OPT_GLOBAL)
global_system_variables.client_collation= default_charset_info; global_system_variables.collation_client= default_charset_info;
else else
{ {
thd->variables.client_collation= global_system_variables.client_collation; thd->variables.collation_client= global_system_variables.collation_client;
} }
} }
bool sys_var_connection_collation::update(THD *thd, set_var *var) bool sys_var_collation_connection::update(THD *thd, set_var *var)
{ {
if (var->type == OPT_GLOBAL) if (var->type == OPT_GLOBAL)
global_system_variables.connection_collation= var->save_result.charset; global_system_variables.collation_connection= var->save_result.charset;
else else
thd->variables.connection_collation= var->save_result.charset; thd->variables.collation_connection= var->save_result.charset;
return 0; return 0;
} }
byte *sys_var_connection_collation::value_ptr(THD *thd, enum_var_type type) byte *sys_var_collation_connection::value_ptr(THD *thd, enum_var_type type)
{ {
CHARSET_INFO *cs= ((type == OPT_GLOBAL) ? CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
global_system_variables.connection_collation : global_system_variables.collation_connection :
thd->variables.connection_collation); thd->variables.collation_connection);
return cs ? (byte*) cs->name : (byte*) ""; return cs ? (byte*) cs->name : (byte*) "";
} }
void sys_var_connection_collation::set_default(THD *thd, enum_var_type type) void sys_var_collation_connection::set_default(THD *thd, enum_var_type type)
{ {
if (type == OPT_GLOBAL) if (type == OPT_GLOBAL)
global_system_variables.connection_collation= default_charset_info; global_system_variables.collation_connection= default_charset_info;
else else
thd->variables.connection_collation= global_system_variables.connection_collation; thd->variables.collation_connection= global_system_variables.collation_connection;
} }
bool sys_var_result_collation::update(THD *thd, set_var *var) bool sys_var_collation_results::update(THD *thd, set_var *var)
{ {
if (var->type == OPT_GLOBAL) if (var->type == OPT_GLOBAL)
global_system_variables.result_collation= var->save_result.charset; global_system_variables.collation_results= var->save_result.charset;
else else
thd->variables.result_collation= var->save_result.charset; thd->variables.collation_results= var->save_result.charset;
return 0; return 0;
} }
byte *sys_var_result_collation::value_ptr(THD *thd, enum_var_type type) byte *sys_var_collation_results::value_ptr(THD *thd, enum_var_type type)
{ {
CHARSET_INFO *cs= ((type == OPT_GLOBAL) ? CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
global_system_variables.result_collation : global_system_variables.collation_results :
thd->variables.result_collation); thd->variables.collation_results);
return cs ? (byte*) cs->name : (byte*) ""; return cs ? (byte*) cs->name : (byte*) "";
} }
void sys_var_result_collation::set_default(THD *thd, enum_var_type type) void sys_var_collation_results::set_default(THD *thd, enum_var_type type)
{ {
if (type == OPT_GLOBAL) if (type == OPT_GLOBAL)
global_system_variables.result_collation= default_charset_info; global_system_variables.collation_results= default_charset_info;
else else
thd->variables.result_collation= global_system_variables.result_collation; thd->variables.collation_results= global_system_variables.collation_results;
} }
...@@ -1297,16 +1297,16 @@ void sys_var_result_collation::set_default(THD *thd, enum_var_type type) ...@@ -1297,16 +1297,16 @@ void sys_var_result_collation::set_default(THD *thd, enum_var_type type)
Functions to handle SET NAMES and SET CHARACTER SET Functions to handle SET NAMES and SET CHARACTER SET
*****************************************************************************/ *****************************************************************************/
int set_var_client_collation::check(THD *thd) int set_var_collation_client::check(THD *thd)
{ {
return 0; return 0;
} }
int set_var_client_collation::update(THD *thd) int set_var_collation_client::update(THD *thd)
{ {
thd->variables.client_collation= client_collation; thd->variables.collation_client= collation_client;
thd->variables.connection_collation= connection_collation; thd->variables.collation_connection= collation_connection;
thd->variables.result_collation= result_collation; thd->variables.collation_results= collation_results;
thd->protocol_simple.init(thd); thd->protocol_simple.init(thd);
thd->protocol_prep.init(thd); thd->protocol_prep.init(thd);
return 0; return 0;
......
...@@ -420,28 +420,28 @@ SHOW_TYPE type() { return SHOW_CHAR; } ...@@ -420,28 +420,28 @@ SHOW_TYPE type() { return SHOW_CHAR; }
virtual void set_default(THD *thd, enum_var_type type)= 0; virtual void set_default(THD *thd, enum_var_type type)= 0;
}; };
class sys_var_client_collation :public sys_var_collation class sys_var_collation_client :public sys_var_collation
{ {
public: public:
sys_var_client_collation(const char *name_arg) :sys_var_collation(name_arg) {} sys_var_collation_client(const char *name_arg) :sys_var_collation(name_arg) {}
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
byte *value_ptr(THD *thd, enum_var_type type); byte *value_ptr(THD *thd, enum_var_type type);
}; };
class sys_var_connection_collation :public sys_var_collation class sys_var_collation_connection :public sys_var_collation
{ {
public: public:
sys_var_connection_collation(const char *name_arg) :sys_var_collation(name_arg) {} sys_var_collation_connection(const char *name_arg) :sys_var_collation(name_arg) {}
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
byte *value_ptr(THD *thd, enum_var_type type); byte *value_ptr(THD *thd, enum_var_type type);
}; };
class sys_var_result_collation :public sys_var_collation class sys_var_collation_results :public sys_var_collation
{ {
public: public:
sys_var_result_collation(const char *name_arg) :sys_var_collation(name_arg) {} sys_var_collation_results(const char *name_arg) :sys_var_collation(name_arg) {}
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
byte *value_ptr(THD *thd, enum_var_type type); byte *value_ptr(THD *thd, enum_var_type type);
...@@ -553,18 +553,18 @@ public: ...@@ -553,18 +553,18 @@ public:
/* For SET NAMES and SET CHARACTER SET */ /* For SET NAMES and SET CHARACTER SET */
class set_var_client_collation: public set_var_base class set_var_collation_client: public set_var_base
{ {
CHARSET_INFO *client_collation; CHARSET_INFO *collation_client;
CHARSET_INFO *connection_collation; CHARSET_INFO *collation_connection;
CHARSET_INFO *result_collation; CHARSET_INFO *collation_results;
public: public:
set_var_client_collation(CHARSET_INFO *client_coll_arg, set_var_collation_client(CHARSET_INFO *client_coll_arg,
CHARSET_INFO *connection_coll_arg, CHARSET_INFO *connection_coll_arg,
CHARSET_INFO *result_coll_arg) CHARSET_INFO *result_coll_arg)
:client_collation(client_coll_arg), :collation_client(client_coll_arg),
connection_collation(connection_coll_arg), collation_connection(connection_coll_arg),
result_collation(result_coll_arg) collation_results(result_coll_arg)
{} {}
int check(THD *thd); int check(THD *thd);
int update(THD *thd); int update(THD *thd);
......
...@@ -207,7 +207,6 @@ void THD::init(void) ...@@ -207,7 +207,6 @@ void THD::init(void)
{ {
pthread_mutex_lock(&LOCK_global_system_variables); pthread_mutex_lock(&LOCK_global_system_variables);
variables= global_system_variables; variables= global_system_variables;
variables.client_collation= default_charset_info;
pthread_mutex_unlock(&LOCK_global_system_variables); pthread_mutex_unlock(&LOCK_global_system_variables);
server_status= SERVER_STATUS_AUTOCOMMIT; server_status= SERVER_STATUS_AUTOCOMMIT;
options= thd_startup_options; options= thd_startup_options;
......
...@@ -382,9 +382,9 @@ struct system_variables ...@@ -382,9 +382,9 @@ struct system_variables
my_bool low_priority_updates; my_bool low_priority_updates;
my_bool new_mode; my_bool new_mode;
CHARSET_INFO *client_collation; CHARSET_INFO *collation_client;
CHARSET_INFO *connection_collation; CHARSET_INFO *collation_connection;
CHARSET_INFO *result_collation; CHARSET_INFO *collation_results;
}; };
void free_tmp_table(THD *thd, TABLE *entry); void free_tmp_table(THD *thd, TABLE *entry);
...@@ -665,7 +665,7 @@ public: ...@@ -665,7 +665,7 @@ public:
net.report_error= 1; net.report_error= 1;
DBUG_PRINT("error",("Fatal error set")); DBUG_PRINT("error",("Fatal error set"));
} }
inline CHARSET_INFO *charset() { return variables.client_collation; } inline CHARSET_INFO *charset() { return variables.collation_client; }
}; };
/* /*
......
...@@ -3924,7 +3924,7 @@ text_literal: ...@@ -3924,7 +3924,7 @@ text_literal:
TEXT_STRING_literal TEXT_STRING_literal
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
$$ = new Item_string($1.str,$1.length,thd->variables.connection_collation); $$ = new Item_string($1.str,$1.length,thd->variables.collation_connection);
} }
| NCHAR_STRING | NCHAR_STRING
{ $$= new Item_string($1.str,$1.length,national_charset_info); } { $$= new Item_string($1.str,$1.length,national_charset_info); }
...@@ -3936,7 +3936,7 @@ text_literal: ...@@ -3936,7 +3936,7 @@ text_literal:
text_string: text_string:
TEXT_STRING_literal TEXT_STRING_literal
{ $$= new String($1.str,$1.length,YYTHD->variables.connection_collation); } { $$= new String($1.str,$1.length,YYTHD->variables.collation_connection); }
| HEX_NUM | HEX_NUM
{ {
Item *tmp = new Item_varbinary($1.str,$1.length); Item *tmp = new Item_varbinary($1.str,$1.length);
...@@ -4106,14 +4106,14 @@ TEXT_STRING_literal: ...@@ -4106,14 +4106,14 @@ TEXT_STRING_literal:
TEXT_STRING TEXT_STRING
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
if (my_charset_same(thd->charset(),thd->variables.connection_collation)) if (my_charset_same(thd->charset(),thd->variables.collation_connection))
{ {
$$=$1; $$=$1;
} }
else else
{ {
String ident; String ident;
ident.copy($1.str,$1.length,thd->charset(),thd->variables.connection_collation); ident.copy($1.str,$1.length,thd->charset(),thd->variables.collation_connection);
$$.str= thd->strmake(ident.ptr(),ident.length()); $$.str= thd->strmake(ident.ptr(),ident.length());
$$.length= ident.length(); $$.length= ident.length();
} }
...@@ -4405,28 +4405,27 @@ option_value: ...@@ -4405,28 +4405,27 @@ option_value:
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
LEX *lex= Lex; LEX *lex= Lex;
$2= $2 ? $2: global_system_variables.client_collation; $2= $2 ? $2: global_system_variables.collation_client;
$3= $3 ? $3 : $2; $3= $3 ? $3 : $2;
if (!my_charset_same($2,$3)) if (!my_charset_same($2,$3))
{ {
net_printf(YYTHD,ER_COLLATION_CHARSET_MISMATCH, net_printf(thd,ER_COLLATION_CHARSET_MISMATCH,$3->name,$2->csname);
$3->name,$2->csname); YYABORT;
YYABORT;
} }
lex->var_list.push_back(new set_var_client_collation($3,thd->db_charset,$3)); lex->var_list.push_back(new set_var_collation_client($3,thd->db_charset,$3));
} }
| NAMES_SYM charset_name_or_default opt_collate | NAMES_SYM charset_name_or_default opt_collate
{ {
THD *thd= YYTHD;
LEX *lex= Lex; LEX *lex= Lex;
$2= $2 ? $2 : global_system_variables.client_collation; $2= $2 ? $2 : global_system_variables.collation_client;
$3= $3 ? $3 : $2; $3= $3 ? $3 : $2;
if (!my_charset_same($2,$3)) if (!my_charset_same($2,$3))
{ {
net_printf(YYTHD,ER_COLLATION_CHARSET_MISMATCH, net_printf(thd,ER_COLLATION_CHARSET_MISMATCH,$3->name,$2->csname);
$3->name,$2->csname); YYABORT;
YYABORT;
} }
lex->var_list.push_back(new set_var_client_collation($3,$3,$3)); lex->var_list.push_back(new set_var_collation_client($3,$3,$3));
} }
| PASSWORD equal text_or_password | 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