Commit 81836c8e authored by unknown's avatar unknown

more sys_var_str fixes


mysql-test/r/variables.result:
  more tests
mysql-test/t/variables.test:
  more tests
sql/set_var.cc:
  don't crash on NULL
parent 1f08d0b4
......@@ -384,6 +384,15 @@ select @@session.key_buffer_size;
ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable
set ft_boolean_syntax = @@init_connect;
ERROR HY000: Variable 'ft_boolean_syntax' is a GLOBAL variable and should be set with SET GLOBAL
set global ft_boolean_syntax = @@init_connect;
ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of ''
set init_connect = NULL;
ERROR HY000: Variable 'init_connect' is a GLOBAL variable and should be set with SET GLOBAL
set global init_connect = NULL;
set ft_boolean_syntax = @@init_connect;
ERROR HY000: Variable 'ft_boolean_syntax' is a GLOBAL variable and should be set with SET GLOBAL
set global ft_boolean_syntax = @@init_connect;
ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of ''
select @@global.max_user_connections,@@local.max_join_size;
@@global.max_user_connections @@session.max_join_size
100 200
......
......@@ -272,6 +272,15 @@ select @@session.key_buffer_size;
--error 1229
set ft_boolean_syntax = @@init_connect;
--error 1231
set global ft_boolean_syntax = @@init_connect;
--error 1229
set init_connect = NULL;
set global init_connect = NULL;
--error 1229
set ft_boolean_syntax = @@init_connect;
--error 1231
set global ft_boolean_syntax = @@init_connect;
#
# swap
......
......@@ -835,15 +835,11 @@ bool sys_var_str::check(THD *thd, set_var *var)
bool update_sys_var_str(sys_var_str *var_str, rw_lock_t *var_mutex,
set_var *var)
{
char *res= 0, *old_value;
uint new_length= 0;
/* If the string is "", delete old init command */
if (var && (new_length= var->value->str_value.length()))
{
if (!(res= my_strdup_with_length((byte*) var->value->str_value.ptr(),
new_length, MYF(0))))
char *res= 0, *old_value=(char *)(var ? var->value->str_value.ptr() : 0);
uint new_length= (var ? var->value->str_value.length() : 0);
if (!old_value) old_value="";
if (!(res= my_strdup_with_length(old_value, new_length, MYF(0))))
return 1;
}
/*
Replace the old value in such a way that the any thread using
the value will work.
......
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