Commit 220c4531 authored by bar@mysql.com's avatar bar@mysql.com

Merge mysql.com:/home/bar/mysql-5.0-rpl

into  mysql.com:/home/bar/mysql-5.1-new-rpl
parents c4b15b2e 11ccfd80
...@@ -2104,6 +2104,17 @@ com_go(String *buffer,char *line __attribute__((unused))) ...@@ -2104,6 +2104,17 @@ com_go(String *buffer,char *line __attribute__((unused)))
if (!mysql_num_rows(result) && ! quick && !column_types_flag) if (!mysql_num_rows(result) && ! quick && !column_types_flag)
{ {
strmov(buff, "Empty set"); strmov(buff, "Empty set");
if (opt_xml)
{
/*
We must print XML header and footer
to produce a well-formed XML even if
the result set is empty (Bug#27608).
*/
init_pager();
print_table_data_xml(result);
end_pager();
}
} }
else else
{ {
......
...@@ -71,4 +71,18 @@ insert into t1 values (1, 2, 'a&b a<b a>b'); ...@@ -71,4 +71,18 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
<field name="NULL" xsi:nil="true" /> <field name="NULL" xsi:nil="true" />
</row> </row>
</resultset> </resultset>
<?xml version="1.0"?>
<resultset statement="select 1 limit 0
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></resultset>
--------------
select 1 limit 0
--------------
<?xml version="1.0"?>
<resultset statement="select 1 limit 0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></resultset>
Empty set
Bye
drop table t1; drop table t1;
...@@ -753,6 +753,37 @@ set lc_time_names=0; ...@@ -753,6 +753,37 @@ set lc_time_names=0;
select @@lc_time_names; select @@lc_time_names;
@@lc_time_names @@lc_time_names
en_US en_US
select @@global.lc_time_names, @@lc_time_names;
@@global.lc_time_names @@lc_time_names
en_US en_US
set @@global.lc_time_names=fr_FR;
select @@global.lc_time_names, @@lc_time_names;
@@global.lc_time_names @@lc_time_names
fr_FR en_US
New connection
select @@global.lc_time_names, @@lc_time_names;
@@global.lc_time_names @@lc_time_names
fr_FR fr_FR
set @@lc_time_names=ru_RU;
select @@global.lc_time_names, @@lc_time_names;
@@global.lc_time_names @@lc_time_names
fr_FR ru_RU
Returnung to default connection
select @@global.lc_time_names, @@lc_time_names;
@@global.lc_time_names @@lc_time_names
fr_FR en_US
set lc_time_names=default;
select @@global.lc_time_names, @@lc_time_names;
@@global.lc_time_names @@lc_time_names
fr_FR fr_FR
set @@global.lc_time_names=default;
select @@global.lc_time_names, @@lc_time_names;
@@global.lc_time_names @@lc_time_names
en_US fr_FR
set @@lc_time_names=default;
select @@global.lc_time_names, @@lc_time_names;
@@global.lc_time_names @@lc_time_names
en_US en_US
set @test = @@query_prealloc_size; set @test = @@query_prealloc_size;
set @@query_prealloc_size = @test; set @@query_prealloc_size = @test;
select @@query_prealloc_size = @test; select @@query_prealloc_size = @test;
......
...@@ -17,5 +17,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b'); ...@@ -17,5 +17,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
--exec $MYSQL --xml test -e "select 1 > 2 from dual" --exec $MYSQL --xml test -e "select 1 > 2 from dual"
--exec $MYSQL --xml test -e "select 1 & 3 from dual" --exec $MYSQL --xml test -e "select 1 & 3 from dual"
--exec $MYSQL --xml test -e "select null from dual" --exec $MYSQL --xml test -e "select null from dual"
--exec $MYSQL --xml test -e "select 1 limit 0"
--exec $MYSQL --xml test -vv -e "select 1 limit 0"
drop table t1; drop table t1;
...@@ -539,6 +539,30 @@ select @@lc_time_names; ...@@ -539,6 +539,30 @@ select @@lc_time_names;
set lc_time_names=0; set lc_time_names=0;
select @@lc_time_names; select @@lc_time_names;
#
# Bug #22648 LC_TIME_NAMES: Setting GLOBAL has no effect
#
select @@global.lc_time_names, @@lc_time_names;
set @@global.lc_time_names=fr_FR;
select @@global.lc_time_names, @@lc_time_names;
--echo New connection
connect (con1,localhost,root,,);
connection con1;
select @@global.lc_time_names, @@lc_time_names;
set @@lc_time_names=ru_RU;
select @@global.lc_time_names, @@lc_time_names;
disconnect con1;
connection default;
--echo Returnung to default connection
select @@global.lc_time_names, @@lc_time_names;
set lc_time_names=default;
select @@global.lc_time_names, @@lc_time_names;
set @@global.lc_time_names=default;
select @@global.lc_time_names, @@lc_time_names;
set @@lc_time_names=default;
select @@global.lc_time_names, @@lc_time_names;
# #
# Bug #13334: query_prealloc_size default less than minimum # Bug #13334: query_prealloc_size default less than minimum
# #
......
...@@ -147,6 +147,7 @@ typedef struct my_locale_st ...@@ -147,6 +147,7 @@ typedef struct my_locale_st
extern MY_LOCALE my_locale_en_US; extern MY_LOCALE my_locale_en_US;
extern MY_LOCALE *my_locales[]; extern MY_LOCALE *my_locales[];
extern MY_LOCALE *my_default_lc_time_names;
MY_LOCALE *my_locale_by_name(const char *name); MY_LOCALE *my_locale_by_name(const char *name);
MY_LOCALE *my_locale_by_number(uint number); MY_LOCALE *my_locale_by_number(uint number);
......
...@@ -329,6 +329,7 @@ static char *mysqld_user, *mysqld_chroot, *log_error_file_ptr; ...@@ -329,6 +329,7 @@ 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 *character_set_filesystem_name;
static char *lc_time_names_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 *default_storage_engine_str; static char *default_storage_engine_str;
...@@ -565,6 +566,8 @@ CHARSET_INFO *system_charset_info, *files_charset_info ; ...@@ -565,6 +566,8 @@ 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; CHARSET_INFO *character_set_filesystem;
MY_LOCALE *my_default_lc_time_names;
SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache; SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache;
SHOW_COMP_OPTION have_geometry, have_rtree_keys; SHOW_COMP_OPTION have_geometry, have_rtree_keys;
SHOW_COMP_OPTION have_crypt, have_compress; SHOW_COMP_OPTION have_crypt, have_compress;
...@@ -2913,6 +2916,14 @@ static int init_common_variables(const char *conf_file_name, int argc, ...@@ -2913,6 +2916,14 @@ static int init_common_variables(const char *conf_file_name, int argc,
return 1; return 1;
global_system_variables.character_set_filesystem= character_set_filesystem; global_system_variables.character_set_filesystem= character_set_filesystem;
if (!(my_default_lc_time_names=
my_locale_by_name(lc_time_names_name)))
{
sql_print_error("Unknown locale: '%s'", MYF(0), lc_time_names_name);
return 1;
}
global_system_variables.lc_time_names= my_default_lc_time_names;
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);
...@@ -5011,6 +5022,7 @@ enum options_mysqld ...@@ -5011,6 +5022,7 @@ enum options_mysqld
OPT_DEFAULT_COLLATION, OPT_DEFAULT_COLLATION,
OPT_CHARACTER_SET_CLIENT_HANDSHAKE, OPT_CHARACTER_SET_CLIENT_HANDSHAKE,
OPT_CHARACTER_SET_FILESYSTEM, OPT_CHARACTER_SET_FILESYSTEM,
OPT_LC_TIME_NAMES,
OPT_INIT_CONNECT, OPT_INIT_CONNECT,
OPT_INIT_SLAVE, OPT_INIT_SLAVE,
OPT_SECURE_AUTH, OPT_SECURE_AUTH,
...@@ -5354,6 +5366,11 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite, ...@@ -5354,6 +5366,11 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
"Client error messages in given language. May be given as a full path.", "Client error messages in given language. May be given as a full path.",
(gptr*) &language_ptr, (gptr*) &language_ptr, 0, GET_STR, REQUIRED_ARG, (gptr*) &language_ptr, (gptr*) &language_ptr, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"lc-time-names", OPT_LC_TIME_NAMES,
"Set the language used for the month names and the days of the week.",
(gptr*) &lc_time_names_name,
(gptr*) &lc_time_names_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"local-infile", OPT_LOCAL_INFILE, {"local-infile", OPT_LOCAL_INFILE,
"Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0).", "Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0).",
(gptr*) &opt_local_infile, (gptr*) &opt_local_infile,
...@@ -7220,7 +7237,7 @@ static void mysql_init_variables(void) ...@@ -7220,7 +7237,7 @@ static void mysql_init_variables(void)
default_collation_name= compiled_default_collation_name; default_collation_name= compiled_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"; character_set_filesystem_name= (char*) "binary";
lc_time_names_name= (char*) "en_US";
/* Set default values for some option variables */ /* Set default values for some option variables */
default_storage_engine_str= (char*) "MyISAM"; default_storage_engine_str= (char*) "MyISAM";
global_system_variables.table_type= myisam_hton; global_system_variables.table_type= myisam_hton;
......
...@@ -3038,6 +3038,9 @@ bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var) ...@@ -3038,6 +3038,9 @@ bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var)
bool sys_var_thd_lc_time_names::update(THD *thd, set_var *var) bool sys_var_thd_lc_time_names::update(THD *thd, set_var *var)
{ {
if (var->type == OPT_GLOBAL)
global_system_variables.lc_time_names= var->save_result.locale_value;
else
thd->variables.lc_time_names= var->save_result.locale_value; thd->variables.lc_time_names= var->save_result.locale_value;
return 0; return 0;
} }
...@@ -3046,13 +3049,18 @@ bool sys_var_thd_lc_time_names::update(THD *thd, set_var *var) ...@@ -3046,13 +3049,18 @@ bool sys_var_thd_lc_time_names::update(THD *thd, set_var *var)
byte *sys_var_thd_lc_time_names::value_ptr(THD *thd, enum_var_type type, byte *sys_var_thd_lc_time_names::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base) LEX_STRING *base)
{ {
return (byte *)(thd->variables.lc_time_names->name); return type == OPT_GLOBAL ?
(byte *) global_system_variables.lc_time_names->name :
(byte *) thd->variables.lc_time_names->name;
} }
void sys_var_thd_lc_time_names::set_default(THD *thd, enum_var_type type) void sys_var_thd_lc_time_names::set_default(THD *thd, enum_var_type type)
{ {
thd->variables.lc_time_names = &my_locale_en_US; if (type == OPT_GLOBAL)
global_system_variables.lc_time_names= my_default_lc_time_names;
else
thd->variables.lc_time_names= global_system_variables.lc_time_names;
} }
/* /*
......
...@@ -378,7 +378,6 @@ void THD::init(void) ...@@ -378,7 +378,6 @@ void THD::init(void)
update_charset(); update_charset();
reset_current_stmt_binlog_row_based(); reset_current_stmt_binlog_row_based();
bzero((char *) &status_var, sizeof(status_var)); bzero((char *) &status_var, sizeof(status_var));
variables.lc_time_names = &my_locale_en_US;
} }
......
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