merged bug 37339 to 5.1-bugteam
This commit is contained in:
commit
552a1bd352
11
mysql-test/r/ctype_filesystem.result
Normal file
11
mysql-test/r/ctype_filesystem.result
Normal file
@ -0,0 +1,11 @@
|
||||
SET CHARACTER SET utf8;
|
||||
SHOW VARIABLES like 'character_sets_dir';
|
||||
Variable_name Value
|
||||
character_sets_dir /ß/
|
||||
SHOW VARIABLES like 'character_set_filesystem';
|
||||
Variable_name Value
|
||||
character_set_filesystem latin1
|
||||
SHOW VARIABLES like 'character_set_client';
|
||||
Variable_name Value
|
||||
character_set_client utf8
|
||||
SET CHARACTER SET default;
|
2
mysql-test/t/ctype_filesystem-master.opt
Normal file
2
mysql-test/t/ctype_filesystem-master.opt
Normal file
@ -0,0 +1,2 @@
|
||||
--character-sets-dir=/ß
|
||||
--character-set-filesystem=latin1
|
5
mysql-test/t/ctype_filesystem.test
Normal file
5
mysql-test/t/ctype_filesystem.test
Normal file
@ -0,0 +1,5 @@
|
||||
SET CHARACTER SET utf8;
|
||||
SHOW VARIABLES like 'character_sets_dir';
|
||||
SHOW VARIABLES like 'character_set_filesystem';
|
||||
SHOW VARIABLES like 'character_set_client';
|
||||
SET CHARACTER SET default;
|
@ -3377,12 +3377,14 @@ static int init_common_variables(const char *conf_file_name, int argc,
|
||||
sys_init_connect.value_length= strlen(opt_init_connect);
|
||||
else
|
||||
sys_init_connect.value=my_strdup("",MYF(0));
|
||||
sys_init_connect.is_os_charset= TRUE;
|
||||
|
||||
sys_init_slave.value_length= 0;
|
||||
if ((sys_init_slave.value= opt_init_slave))
|
||||
sys_init_slave.value_length= strlen(opt_init_slave);
|
||||
else
|
||||
sys_init_slave.value=my_strdup("",MYF(0));
|
||||
sys_init_slave.is_os_charset= TRUE;
|
||||
|
||||
/* check log options and issue warnings if needed */
|
||||
if (opt_log && opt_logname && !(log_output_options & LOG_FILE) &&
|
||||
|
@ -176,14 +176,14 @@ static sys_var_bool_ptr sys_automatic_sp_privileges(&vars, "automatic_sp_privile
|
||||
static sys_var_const sys_back_log(&vars, "back_log",
|
||||
OPT_GLOBAL, SHOW_LONG,
|
||||
(uchar*) &back_log);
|
||||
static sys_var_const_str sys_basedir(&vars, "basedir", mysql_home);
|
||||
static sys_var_const_os_str sys_basedir(&vars, "basedir", mysql_home);
|
||||
static sys_var_long_ptr sys_binlog_cache_size(&vars, "binlog_cache_size",
|
||||
&binlog_cache_size);
|
||||
static sys_var_thd_binlog_format sys_binlog_format(&vars, "binlog_format",
|
||||
&SV::binlog_format);
|
||||
static sys_var_thd_ulong sys_bulk_insert_buff_size(&vars, "bulk_insert_buffer_size",
|
||||
&SV::bulk_insert_buff_size);
|
||||
static sys_var_const sys_character_sets_dir(&vars,
|
||||
static sys_var_const_os sys_character_sets_dir(&vars,
|
||||
"character_sets_dir",
|
||||
OPT_GLOBAL, SHOW_CHAR,
|
||||
(uchar*)
|
||||
@ -233,7 +233,7 @@ static sys_var_long_ptr sys_concurrent_insert(&vars, "concurrent_insert",
|
||||
&myisam_concurrent_insert);
|
||||
static sys_var_long_ptr sys_connect_timeout(&vars, "connect_timeout",
|
||||
&connect_timeout);
|
||||
static sys_var_const_str sys_datadir(&vars, "datadir", mysql_real_data_home);
|
||||
static sys_var_const_os_str sys_datadir(&vars, "datadir", mysql_real_data_home);
|
||||
#ifndef DBUG_OFF
|
||||
static sys_var_thd_dbug sys_dbug(&vars, "debug");
|
||||
#endif
|
||||
@ -466,7 +466,7 @@ static sys_var_thd_ulong sys_optimizer_search_depth(&vars, "optimizer_sea
|
||||
static sys_var_const sys_pid_file(&vars, "pid_file",
|
||||
OPT_GLOBAL, SHOW_CHAR,
|
||||
(uchar*) pidfile_name);
|
||||
static sys_var_const sys_plugin_dir(&vars, "plugin_dir",
|
||||
static sys_var_const_os sys_plugin_dir(&vars, "plugin_dir",
|
||||
OPT_GLOBAL, SHOW_CHAR,
|
||||
(uchar*) opt_plugin_dir);
|
||||
static sys_var_const sys_port(&vars, "port",
|
||||
@ -538,7 +538,7 @@ static sys_var_const sys_thread_concurrency(&vars, "thread_concurrency",
|
||||
static sys_var_const sys_thread_stack(&vars, "thread_stack",
|
||||
OPT_GLOBAL, SHOW_LONG,
|
||||
(uchar*) &my_thread_stack_size);
|
||||
static sys_var_readonly sys_tmpdir(&vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
|
||||
static sys_var_readonly_os sys_tmpdir(&vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
|
||||
static sys_var_thd_ulong sys_trans_alloc_block_size(&vars, "transaction_alloc_block_size",
|
||||
&SV::trans_alloc_block_size,
|
||||
0, fix_trans_mem_root);
|
||||
@ -589,17 +589,17 @@ static sys_var_thd_sql_mode sys_sql_mode(&vars, "sql_mode",
|
||||
#ifdef HAVE_OPENSSL
|
||||
extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher,
|
||||
*opt_ssl_key;
|
||||
static sys_var_const_str_ptr sys_ssl_ca(&vars, "ssl_ca", &opt_ssl_ca);
|
||||
static sys_var_const_str_ptr sys_ssl_capath(&vars, "ssl_capath", &opt_ssl_capath);
|
||||
static sys_var_const_str_ptr sys_ssl_cert(&vars, "ssl_cert", &opt_ssl_cert);
|
||||
static sys_var_const_str_ptr sys_ssl_cipher(&vars, "ssl_cipher", &opt_ssl_cipher);
|
||||
static sys_var_const_str_ptr sys_ssl_key(&vars, "ssl_key", &opt_ssl_key);
|
||||
static sys_var_const_os_str_ptr sys_ssl_ca(&vars, "ssl_ca", &opt_ssl_ca);
|
||||
static sys_var_const_os_str_ptr sys_ssl_capath(&vars, "ssl_capath", &opt_ssl_capath);
|
||||
static sys_var_const_os_str_ptr sys_ssl_cert(&vars, "ssl_cert", &opt_ssl_cert);
|
||||
static sys_var_const_os_str_ptr sys_ssl_cipher(&vars, "ssl_cipher", &opt_ssl_cipher);
|
||||
static sys_var_const_os_str_ptr sys_ssl_key(&vars, "ssl_key", &opt_ssl_key);
|
||||
#else
|
||||
static sys_var_const_str sys_ssl_ca(&vars, "ssl_ca", NULL);
|
||||
static sys_var_const_str sys_ssl_capath(&vars, "ssl_capath", NULL);
|
||||
static sys_var_const_str sys_ssl_cert(&vars, "ssl_cert", NULL);
|
||||
static sys_var_const_str sys_ssl_cipher(&vars, "ssl_cipher", NULL);
|
||||
static sys_var_const_str sys_ssl_key(&vars, "ssl_key", NULL);
|
||||
static sys_var_const_os_str sys_ssl_ca(&vars, "ssl_ca", NULL);
|
||||
static sys_var_const_os_str sys_ssl_capath(&vars, "ssl_capath", NULL);
|
||||
static sys_var_const_os_str sys_ssl_cert(&vars, "ssl_cert", NULL);
|
||||
static sys_var_const_os_str sys_ssl_cipher(&vars, "ssl_cipher", NULL);
|
||||
static sys_var_const_os_str sys_ssl_key(&vars, "ssl_key", NULL);
|
||||
#endif
|
||||
static sys_var_thd_enum
|
||||
sys_updatable_views_with_limit(&vars, "updatable_views_with_limit",
|
||||
@ -936,6 +936,7 @@ bool update_sys_var_str(sys_var_str *var_str, rw_lock_t *var_mutex,
|
||||
old_value= var_str->value;
|
||||
var_str->value= res;
|
||||
var_str->value_length= new_length;
|
||||
var_str->is_os_charset= FALSE;
|
||||
rw_unlock(var_mutex);
|
||||
my_free(old_value, MYF(MY_ALLOW_ZERO_PTR));
|
||||
return 0;
|
||||
@ -1805,6 +1806,13 @@ err:
|
||||
}
|
||||
|
||||
|
||||
CHARSET_INFO *sys_var::charset(THD *thd)
|
||||
{
|
||||
return is_os_charset ? thd->variables.character_set_filesystem :
|
||||
system_charset_info;
|
||||
}
|
||||
|
||||
|
||||
bool sys_var_thd_enum::update(THD *thd, set_var *var)
|
||||
{
|
||||
if (var->type == OPT_GLOBAL)
|
||||
|
@ -71,6 +71,14 @@ public:
|
||||
|
||||
sys_after_update_func after_update;
|
||||
bool no_support_one_shot;
|
||||
/*
|
||||
true if the value is in character_set_filesystem,
|
||||
false otherwise.
|
||||
Note that we can't use a pointer to the charset as the system var is
|
||||
instantiated in global scope and the charset pointers are initialized
|
||||
later.
|
||||
*/
|
||||
bool is_os_charset;
|
||||
sys_var(const char *name_arg, sys_after_update_func func= NULL,
|
||||
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
|
||||
:name(name_arg), after_update(func), no_support_one_shot(1),
|
||||
@ -107,6 +115,7 @@ public:
|
||||
{ return option_limits == 0; }
|
||||
virtual bool is_struct() { return 0; }
|
||||
virtual bool is_readonly() const { return 0; }
|
||||
CHARSET_INFO *charset(THD *thd);
|
||||
virtual sys_var_pluginvar *cast_pluginvar() { return 0; }
|
||||
|
||||
protected:
|
||||
@ -291,6 +300,18 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class sys_var_const_os_str: public sys_var_const_str
|
||||
{
|
||||
public:
|
||||
sys_var_const_os_str(sys_var_chain *chain, const char *name_arg,
|
||||
const char *value_arg)
|
||||
:sys_var_const_str(chain, name_arg, value_arg)
|
||||
{
|
||||
is_os_charset= TRUE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class sys_var_const_str_ptr :public sys_var
|
||||
{
|
||||
public:
|
||||
@ -320,6 +341,18 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class sys_var_const_os_str_ptr :public sys_var_const_str_ptr
|
||||
{
|
||||
public:
|
||||
sys_var_const_os_str_ptr(sys_var_chain *chain, const char *name_arg,
|
||||
char **value_arg)
|
||||
:sys_var_const_str_ptr(chain, name_arg, value_arg)
|
||||
{
|
||||
is_os_charset= TRUE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class sys_var_enum :public sys_var
|
||||
{
|
||||
uint *value;
|
||||
@ -929,6 +962,19 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class sys_var_readonly_os: public sys_var_readonly
|
||||
{
|
||||
public:
|
||||
sys_var_readonly_os(sys_var_chain *chain, const char *name_arg, enum_var_type type,
|
||||
SHOW_TYPE show_type_arg,
|
||||
sys_value_ptr_func value_ptr_func_arg)
|
||||
:sys_var_readonly(chain, name_arg, type, show_type_arg, value_ptr_func_arg)
|
||||
{
|
||||
is_os_charset= TRUE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Global-only, read-only variable. E.g. command line option.
|
||||
*/
|
||||
@ -957,6 +1003,22 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class sys_var_const_os: public sys_var_const
|
||||
{
|
||||
public:
|
||||
enum_var_type var_type;
|
||||
SHOW_TYPE show_type_value;
|
||||
uchar *ptr;
|
||||
sys_var_const_os(sys_var_chain *chain, const char *name_arg,
|
||||
enum_var_type type,
|
||||
SHOW_TYPE show_type_arg, uchar *ptr_arg)
|
||||
:sys_var_const(chain, name_arg, type, show_type_arg, ptr_arg)
|
||||
{
|
||||
is_os_charset= TRUE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class sys_var_have_option: public sys_var
|
||||
{
|
||||
protected:
|
||||
|
@ -2087,6 +2087,7 @@ static bool show_status_array(THD *thd, const char *wild,
|
||||
COND *partial_cond= 0;
|
||||
enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
|
||||
bool res= FALSE;
|
||||
CHARSET_INFO *charset= system_charset_info;
|
||||
DBUG_ENTER("show_status_array");
|
||||
|
||||
thd->count_cuted_fields= CHECK_FIELD_WARN;
|
||||
@ -2135,9 +2136,10 @@ static bool show_status_array(THD *thd, const char *wild,
|
||||
|
||||
if (show_type == SHOW_SYS)
|
||||
{
|
||||
show_type= ((sys_var*) value)->show_type();
|
||||
value= (char*) ((sys_var*) value)->value_ptr(thd, value_type,
|
||||
&null_lex_str);
|
||||
sys_var *var= ((sys_var *) value);
|
||||
show_type= var->show_type();
|
||||
value= (char*) var->value_ptr(thd, value_type, &null_lex_str);
|
||||
charset= var->charset(thd);
|
||||
}
|
||||
|
||||
pos= end= buff;
|
||||
@ -2213,7 +2215,7 @@ static bool show_status_array(THD *thd, const char *wild,
|
||||
DBUG_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
table->field[1]->store(pos, (uint32) (end - pos), system_charset_info);
|
||||
table->field[1]->store(pos, (uint32) (end - pos), charset);
|
||||
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
|
||||
table->field[1]->set_notnull();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user