1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

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

into mysql.com:/usr/home/ram/work/5.0.b10339


mysql-test/r/variables.result:
  Auto merged
mysql-test/t/variables.test:
  Auto merged
sql/set_var.cc:
  Auto merged
This commit is contained in:
unknown
2005-05-18 14:46:05 +05:00
4 changed files with 19 additions and 0 deletions

View File

@ -515,3 +515,7 @@ show warnings;
Level Code Message Level Code Message
Warning 1329 No data to FETCH Warning 1329 No data to FETCH
drop table t1; drop table t1;
set @@warning_count=1;
ERROR HY000: Variable 'warning_count' is a read only variable
set @@global.error_count=1;
ERROR HY000: Variable 'error_count' is a read only variable

View File

@ -387,3 +387,11 @@ select a into @x from t1;
show warnings; show warnings;
drop table t1; drop table t1;
#
# Bug #10339: read only variables.
#
--error 1238
set @@warning_count=1;
--error 1238
set @@global.error_count=1;

View File

@ -2954,6 +2954,11 @@ bool not_all_support_one_shot(List<set_var_base> *var_list)
int set_var::check(THD *thd) int set_var::check(THD *thd)
{ {
if (var->is_readonly())
{
my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0), var->name, "read only");
return -1;
}
if (var->check_type(type)) if (var->check_type(type))
{ {
int err= type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE; int err= type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE;

View File

@ -75,6 +75,7 @@ public:
{ return option_limits == 0; } { return option_limits == 0; }
Item *item(THD *thd, enum_var_type type, LEX_STRING *base); Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
virtual bool is_struct() { return 0; } virtual bool is_struct() { return 0; }
virtual bool is_readonly() const { return 0; }
}; };
@ -699,6 +700,7 @@ public:
return (*value_ptr_func)(thd); return (*value_ptr_func)(thd);
} }
SHOW_TYPE type() { return show_type; } SHOW_TYPE type() { return show_type; }
bool is_readonly() const { return 1; }
}; };
class sys_var_thd_time_zone :public sys_var_thd class sys_var_thd_time_zone :public sys_var_thd