summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <ramil@mysql.com>2005-05-18 14:46:05 +0500
committerunknown <ramil@mysql.com>2005-05-18 14:46:05 +0500
commit9971175072131d736ede0f8a32b3d3da3436150c (patch)
tree62b43460e475729746b88c94737336fd957ddc1a
parent0a21bf0c5a39e8f49b4fe39926311f08ef7d10eb (diff)
parent7c1d520ef1a18ad397499de6d70debe5be81dd99 (diff)
downloadmariadb-git-9971175072131d736ede0f8a32b3d3da3436150c.tar.gz
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
-rw-r--r--mysql-test/r/variables.result4
-rw-r--r--mysql-test/t/variables.test8
-rw-r--r--sql/set_var.cc5
-rw-r--r--sql/set_var.h2
4 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 5e9a0e11c24..c7f980df350 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -515,3 +515,7 @@ show warnings;
Level Code Message
Warning 1329 No data to FETCH
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
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index b6059ac00e3..9e8a7a1b56f 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -387,3 +387,11 @@ select a into @x from t1;
show warnings;
drop table t1;
+#
+# Bug #10339: read only variables.
+#
+
+--error 1238
+set @@warning_count=1;
+--error 1238
+set @@global.error_count=1;
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 9e26a1f2626..b8059779a2a 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -2954,6 +2954,11 @@ bool not_all_support_one_shot(List<set_var_base> *var_list)
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))
{
int err= type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE;
diff --git a/sql/set_var.h b/sql/set_var.h
index 32f45187124..37522a0b753 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -75,6 +75,7 @@ public:
{ return option_limits == 0; }
Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
virtual bool is_struct() { return 0; }
+ virtual bool is_readonly() const { return 0; }
};
@@ -699,6 +700,7 @@ public:
return (*value_ptr_func)(thd);
}
SHOW_TYPE type() { return show_type; }
+ bool is_readonly() const { return 1; }
};
class sys_var_thd_time_zone :public sys_var_thd