Commit a46ef2a8 authored by unknown's avatar unknown

Merge aelkin@bk-internal.mysql.com:/home/bk/mysql-5.0

into  mysql.com:/usr_rh9/home/elkin.rh9/MySQL/BARE/mysql-5.0

parents 8292e1e6 3c9952a1
...@@ -566,3 +566,21 @@ set global character_set_system = latin1; ...@@ -566,3 +566,21 @@ set global character_set_system = latin1;
ERROR HY000: Variable 'character_set_system' is a read only variable ERROR HY000: Variable 'character_set_system' is a read only variable
set @@global.version_compile_os='234'; set @@global.version_compile_os='234';
ERROR HY000: Variable 'version_compile_os' is a read only variable ERROR HY000: Variable 'version_compile_os' is a read only variable
set character_set_filesystem=latin1;
select @@character_set_filesystem;
@@character_set_filesystem
latin1
set @@global.character_set_filesystem=latin2;
set character_set_filesystem=latin1;
select @@character_set_filesystem;
@@character_set_filesystem
latin1
set @@global.character_set_filesystem=latin2;
set character_set_filesystem=default;
select @@character_set_filesystem;
@@character_set_filesystem
latin2
set @@global.character_set_filesystem=default;
select @@global.character_set_filesystem;
@@global.character_set_filesystem
binary
...@@ -456,4 +456,18 @@ set global character_set_system = latin1; ...@@ -456,4 +456,18 @@ set global character_set_system = latin1;
--error 1238 --error 1238
set @@global.version_compile_os='234'; set @@global.version_compile_os='234';
#
# Check character_set_filesystem variable
#
set character_set_filesystem=latin1;
select @@character_set_filesystem;
set @@global.character_set_filesystem=latin2;
set character_set_filesystem=latin1;
select @@character_set_filesystem;
set @@global.character_set_filesystem=latin2;
set character_set_filesystem=default;
select @@character_set_filesystem;
set @@global.character_set_filesystem=default;
select @@global.character_set_filesystem;
# End of 5.0 tests # End of 5.0 tests
...@@ -321,6 +321,7 @@ static const char *sql_mode_str= "OFF"; ...@@ -321,6 +321,7 @@ static const char *sql_mode_str= "OFF";
static char *mysqld_user, *mysqld_chroot, *log_error_file_ptr; static char *mysqld_user, *mysqld_chroot, *log_error_file_ptr;
static char *opt_init_slave, *language_ptr, *opt_init_connect; static char *opt_init_slave, *language_ptr, *opt_init_connect;
static char *default_character_set_name; static char *default_character_set_name;
static char *character_set_filesystem_name;
static char *my_bind_addr_str; static char *my_bind_addr_str;
static char *default_collation_name; static char *default_collation_name;
static char mysql_data_home_buff[2]; static char mysql_data_home_buff[2];
...@@ -469,6 +470,7 @@ MY_BITMAP temp_pool; ...@@ -469,6 +470,7 @@ MY_BITMAP temp_pool;
CHARSET_INFO *system_charset_info, *files_charset_info ; CHARSET_INFO *system_charset_info, *files_charset_info ;
CHARSET_INFO *national_charset_info, *table_alias_charset; CHARSET_INFO *national_charset_info, *table_alias_charset;
CHARSET_INFO *character_set_filesystem;
SHOW_COMP_OPTION have_berkeley_db, have_innodb, have_isam, have_ndbcluster, SHOW_COMP_OPTION have_berkeley_db, have_innodb, have_isam, have_ndbcluster,
have_example_db, have_archive_db, have_csv_db; have_example_db, have_archive_db, have_csv_db;
...@@ -2677,6 +2679,12 @@ static int init_common_variables(const char *conf_file_name, int argc, ...@@ -2677,6 +2679,12 @@ static int init_common_variables(const char *conf_file_name, int argc,
global_system_variables.character_set_client= default_charset_info; global_system_variables.character_set_client= default_charset_info;
global_system_variables.collation_connection= default_charset_info; global_system_variables.collation_connection= default_charset_info;
if (!(character_set_filesystem=
get_charset_by_csname(character_set_filesystem_name,
MY_CS_PRIMARY, MYF(MY_WME))))
return 1;
global_system_variables.character_set_filesystem= character_set_filesystem;
sys_init_connect.value_length= 0; sys_init_connect.value_length= 0;
if ((sys_init_connect.value= opt_init_connect)) if ((sys_init_connect.value= opt_init_connect))
sys_init_connect.value_length= strlen(opt_init_connect); sys_init_connect.value_length= strlen(opt_init_connect);
...@@ -4563,6 +4571,7 @@ enum options_mysqld ...@@ -4563,6 +4571,7 @@ enum options_mysqld
OPT_GROUP_CONCAT_MAX_LEN, OPT_GROUP_CONCAT_MAX_LEN,
OPT_DEFAULT_COLLATION, OPT_DEFAULT_COLLATION,
OPT_CHARACTER_SET_CLIENT_HANDSHAKE, OPT_CHARACTER_SET_CLIENT_HANDSHAKE,
OPT_CHARACTER_SET_FILESYSTEM,
OPT_INIT_CONNECT, OPT_INIT_CONNECT,
OPT_INIT_SLAVE, OPT_INIT_SLAVE,
OPT_SECURE_AUTH, OPT_SECURE_AUTH,
...@@ -4671,6 +4680,11 @@ Disable with --skip-bdb (will save memory).", ...@@ -4671,6 +4680,11 @@ Disable with --skip-bdb (will save memory).",
(gptr*) &opt_character_set_client_handshake, (gptr*) &opt_character_set_client_handshake,
(gptr*) &opt_character_set_client_handshake, (gptr*) &opt_character_set_client_handshake,
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"character-set-filesystem", OPT_CHARACTER_SET_FILESYSTEM,
"Set the filesystem character set.",
(gptr*) &character_set_filesystem_name,
(gptr*) &character_set_filesystem_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"character-set-server", 'C', "Set the default character set.", {"character-set-server", 'C', "Set the default character set.",
(gptr*) &default_character_set_name, (gptr*) &default_character_set_name, (gptr*) &default_character_set_name, (gptr*) &default_character_set_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
...@@ -6260,6 +6274,7 @@ static void mysql_init_variables(void) ...@@ -6260,6 +6274,7 @@ static void mysql_init_variables(void)
files_charset_info= &my_charset_utf8_general_ci; files_charset_info= &my_charset_utf8_general_ci;
national_charset_info= &my_charset_utf8_general_ci; national_charset_info= &my_charset_utf8_general_ci;
table_alias_charset= &my_charset_bin; table_alias_charset= &my_charset_bin;
character_set_filesystem= &my_charset_bin;
opt_date_time_formats[0]= opt_date_time_formats[1]= opt_date_time_formats[2]= 0; opt_date_time_formats[0]= opt_date_time_formats[1]= opt_date_time_formats[2]= 0;
...@@ -6320,6 +6335,7 @@ static void mysql_init_variables(void) ...@@ -6320,6 +6335,7 @@ static void mysql_init_variables(void)
default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME; default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME;
default_collation_name= (char*) MYSQL_DEFAULT_COLLATION_NAME; default_collation_name= (char*) MYSQL_DEFAULT_COLLATION_NAME;
sys_charset_system.value= (char*) system_charset_info->csname; sys_charset_system.value= (char*) system_charset_info->csname;
character_set_filesystem_name= (char*) "binary";
/* Set default values for some option variables */ /* Set default values for some option variables */
......
...@@ -148,6 +148,7 @@ sys_var_character_set_database sys_character_set_database("character_set_databas ...@@ -148,6 +148,7 @@ sys_var_character_set_database sys_character_set_database("character_set_databas
sys_var_character_set_client sys_character_set_client("character_set_client"); sys_var_character_set_client sys_character_set_client("character_set_client");
sys_var_character_set_connection sys_character_set_connection("character_set_connection"); sys_var_character_set_connection sys_character_set_connection("character_set_connection");
sys_var_character_set_results sys_character_set_results("character_set_results"); sys_var_character_set_results sys_character_set_results("character_set_results");
sys_var_character_set_filesystem sys_character_set_filesystem("character_set_filesystem");
sys_var_thd_ulong sys_completion_type("completion_type", sys_var_thd_ulong sys_completion_type("completion_type",
&SV::completion_type, &SV::completion_type,
check_completion_type, check_completion_type,
...@@ -580,6 +581,7 @@ sys_var *sys_variables[]= ...@@ -580,6 +581,7 @@ sys_var *sys_variables[]=
&sys_character_set_client, &sys_character_set_client,
&sys_character_set_connection, &sys_character_set_connection,
&sys_character_set_results, &sys_character_set_results,
&sys_character_set_filesystem,
&sys_charset_system, &sys_charset_system,
&sys_collation_connection, &sys_collation_connection,
&sys_collation_database, &sys_collation_database,
...@@ -771,6 +773,7 @@ struct show_var_st init_vars[]= { ...@@ -771,6 +773,7 @@ struct show_var_st init_vars[]= {
{sys_character_set_client.name,(char*) &sys_character_set_client, SHOW_SYS}, {sys_character_set_client.name,(char*) &sys_character_set_client, SHOW_SYS},
{sys_character_set_connection.name,(char*) &sys_character_set_connection,SHOW_SYS}, {sys_character_set_connection.name,(char*) &sys_character_set_connection,SHOW_SYS},
{sys_character_set_database.name, (char*) &sys_character_set_database,SHOW_SYS}, {sys_character_set_database.name, (char*) &sys_character_set_database,SHOW_SYS},
{sys_character_set_filesystem.name,(char*) &sys_character_set_filesystem, SHOW_SYS},
{sys_character_set_results.name,(char*) &sys_character_set_results, SHOW_SYS}, {sys_character_set_results.name,(char*) &sys_character_set_results, SHOW_SYS},
{sys_character_set_server.name, (char*) &sys_character_set_server,SHOW_SYS}, {sys_character_set_server.name, (char*) &sys_character_set_server,SHOW_SYS},
{sys_charset_system.name, (char*) &sys_charset_system, SHOW_SYS}, {sys_charset_system.name, (char*) &sys_charset_system, SHOW_SYS},
...@@ -2076,6 +2079,32 @@ void sys_var_character_set_client::set_default(THD *thd, enum_var_type type) ...@@ -2076,6 +2079,32 @@ void sys_var_character_set_client::set_default(THD *thd, enum_var_type type)
} }
CHARSET_INFO **
sys_var_character_set_filesystem::ci_ptr(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
return &global_system_variables.character_set_filesystem;
else
return &thd->variables.character_set_filesystem;
}
extern CHARSET_INFO *character_set_filesystem;
void
sys_var_character_set_filesystem::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
global_system_variables.character_set_filesystem= character_set_filesystem;
else
{
thd->variables.character_set_filesystem= (global_system_variables.
character_set_filesystem);
thd->update_charset();
}
}
CHARSET_INFO ** CHARSET_INFO **
sys_var_character_set_results::ci_ptr(THD *thd, enum_var_type type) sys_var_character_set_results::ci_ptr(THD *thd, enum_var_type type)
{ {
......
...@@ -540,6 +540,15 @@ public: ...@@ -540,6 +540,15 @@ public:
virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0; virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0;
}; };
class sys_var_character_set_filesystem :public sys_var_character_set
{
public:
sys_var_character_set_filesystem(const char *name_arg) :
sys_var_character_set(name_arg) {}
void set_default(THD *thd, enum_var_type type);
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
};
class sys_var_character_set_client :public sys_var_character_set class sys_var_character_set_client :public sys_var_character_set
{ {
public: public:
......
...@@ -648,6 +648,9 @@ void THD::update_charset() ...@@ -648,6 +648,9 @@ void THD::update_charset()
charset_is_collation_connection= charset_is_collation_connection=
!String::needs_conversion(0,charset(),variables.collation_connection, !String::needs_conversion(0,charset(),variables.collation_connection,
&not_used); &not_used);
charset_is_character_set_filesystem=
!String::needs_conversion(0, charset(),
variables.character_set_filesystem, &not_used);
} }
......
...@@ -569,6 +569,7 @@ struct system_variables ...@@ -569,6 +569,7 @@ struct system_variables
my_bool old_passwords; my_bool old_passwords;
/* Only charset part of these variables is sensible */ /* Only charset part of these variables is sensible */
CHARSET_INFO *character_set_filesystem;
CHARSET_INFO *character_set_client; CHARSET_INFO *character_set_client;
CHARSET_INFO *character_set_results; CHARSET_INFO *character_set_results;
...@@ -1341,6 +1342,7 @@ public: ...@@ -1341,6 +1342,7 @@ public:
bool query_error, bootstrap, cleanup_done; bool query_error, bootstrap, cleanup_done;
bool tmp_table_used; bool tmp_table_used;
bool charset_is_system_charset, charset_is_collation_connection; bool charset_is_system_charset, charset_is_collation_connection;
bool charset_is_character_set_filesystem;
bool enable_slow_log; /* enable slow log for current statement */ bool enable_slow_log; /* enable slow log for current statement */
bool no_trans_update, abort_on_warning; bool no_trans_update, abort_on_warning;
bool got_warning; /* Set on call to push_warning() */ bool got_warning; /* Set on call to push_warning() */
......
...@@ -684,7 +684,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -684,7 +684,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text
UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_literal UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
NCHAR_STRING opt_component key_cache_name NCHAR_STRING opt_component key_cache_name
sp_opt_label BIN_NUM label_ident sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem
%type <lex_str_ptr> %type <lex_str_ptr>
opt_table_alias opt_table_alias
...@@ -5937,7 +5937,7 @@ select_var_ident: ...@@ -5937,7 +5937,7 @@ select_var_ident:
; ;
into: into:
INTO OUTFILE TEXT_STRING_sys INTO OUTFILE TEXT_STRING_filesystem
{ {
LEX *lex= Lex; LEX *lex= Lex;
lex->uncacheable(UNCACHEABLE_SIDEEFFECT); lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
...@@ -5946,7 +5946,7 @@ into: ...@@ -5946,7 +5946,7 @@ into:
YYABORT; YYABORT;
} }
opt_field_term opt_line_term opt_field_term opt_line_term
| INTO DUMPFILE TEXT_STRING_sys | INTO DUMPFILE TEXT_STRING_filesystem
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (!lex->describe) if (!lex->describe)
...@@ -6930,7 +6930,7 @@ load: LOAD DATA_SYM ...@@ -6930,7 +6930,7 @@ load: LOAD DATA_SYM
}; };
load_data: load_data:
load_data_lock opt_local INFILE TEXT_STRING_sys load_data_lock opt_local INFILE TEXT_STRING_filesystem
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command= SQLCOM_LOAD; lex->sql_command= SQLCOM_LOAD;
...@@ -7459,6 +7459,18 @@ TEXT_STRING_literal: ...@@ -7459,6 +7459,18 @@ TEXT_STRING_literal:
; ;
TEXT_STRING_filesystem:
TEXT_STRING
{
THD *thd= YYTHD;
if (thd->charset_is_character_set_filesystem)
$$= $1;
else
thd->convert_string(&$$, thd->variables.character_set_filesystem,
$1.str, $1.length, thd->charset());
}
;
ident: ident:
IDENT_sys { $$=$1; } IDENT_sys { $$=$1; }
| keyword | keyword
......
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