Below is the list of changes that have just been committed into a local
5.1 repository of dkatz. When dkatz does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-12-11 17:30:42-05:00, dkatz@stripped +4 -0
Bug #30651 Problems with thread_handling system variable
Changed thread_handling variable to a global only, read only variable, as it is currently used.
mysql-test/r/no-threads.result@stripped, 2007-12-11 17:30:36-05:00, dkatz@stripped +4 -0
Bug #30651 Problems with thread_handling system variable
Changed thread_handling variable to a global only, read only variable, as it is currently used.
mysql-test/t/no-threads.test@stripped, 2007-12-11 17:30:37-05:00, dkatz@stripped +10 -0
Bug #30651 Problems with thread_handling system variable
Changed thread_handling variable to a global only, read only variable, as it is currently used.
sql/set_var.cc@stripped, 2007-12-11 17:30:37-05:00, dkatz@stripped +8 -1
Bug #30651 Problems with thread_handling system variable
Changed thread_handling variable to a global only, read only variable, as it is currently used.
sql/set_var.h@stripped, 2007-12-11 17:30:37-05:00, dkatz@stripped +18 -0
Bug #30651 Problems with thread_handling system variable
Changed thread_handling variable to a global only, read only variable, as it is currently used.
diff -Nrup a/mysql-test/r/no-threads.result b/mysql-test/r/no-threads.result
--- a/mysql-test/r/no-threads.result 2007-11-14 16:12:42 -05:00
+++ b/mysql-test/r/no-threads.result 2007-12-11 17:30:36 -05:00
@@ -7,3 +7,7 @@ select 1+2;
SHOW GLOBAL VARIABLES LIKE 'thread_handling';
Variable_name Value
thread_handling no-threads
+select @@session.thread_handling;
+ERROR HY000: Variable 'thread_handling' is a GLOBAL variable
+set GLOBAL thread_handling='one-thread';
+ERROR HY000: Variable 'thread_handling' is a read only variable
diff -Nrup a/mysql-test/t/no-threads.test b/mysql-test/t/no-threads.test
--- a/mysql-test/t/no-threads.test 2007-11-14 16:12:42 -05:00
+++ b/mysql-test/t/no-threads.test 2007-12-11 17:30:37 -05:00
@@ -4,3 +4,13 @@
select 1+1;
select 1+2;
SHOW GLOBAL VARIABLES LIKE 'thread_handling';
+
+#
+# Bug #30651 Problems with thread_handling system variable
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.thread_handling;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set GLOBAL thread_handling='one-thread';
diff -Nrup a/sql/set_var.cc b/sql/set_var.cc
--- a/sql/set_var.cc 2007-11-14 08:28:19 -05:00
+++ b/sql/set_var.cc 2007-12-11 17:30:37 -05:00
@@ -384,7 +384,7 @@ static sys_var_thd_ulong sys_trans_alloc
static sys_var_thd_ulong sys_trans_prealloc_size(&vars, "transaction_prealloc_size",
&SV::trans_prealloc_size,
0, fix_trans_mem_root);
-sys_var_thd_enum sys_thread_handling(&vars, "thread_handling",
+sys_var_enum_const sys_thread_handling(&vars, "thread_handling",
&SV::thread_handling,
&thread_handling_typelib,
NULL);
@@ -1181,6 +1181,13 @@ bool sys_var_enum::update(THD *thd, set_
uchar *sys_var_enum::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{
return (uchar*) enum_names->type_names[*value];
+}
+
+
+uchar *sys_var_enum_const::value_ptr(THD *thd, enum_var_type type,
+ LEX_STRING *base)
+{
+ return (uchar*) enum_names->type_names[global_system_variables.*offset];
}
bool sys_var_thd_ulong::check(THD *thd, set_var *var)
diff -Nrup a/sql/set_var.h b/sql/set_var.h
--- a/sql/set_var.h 2007-10-26 07:58:40 -04:00
+++ b/sql/set_var.h 2007-12-11 17:30:37 -05:00
@@ -305,6 +305,24 @@ public:
};
+class sys_var_enum_const :public sys_var
+{
+ ulong SV::*offset;
+ TYPELIB *enum_names;
+public:
+ sys_var_enum_const(sys_var_chain *chain, const char *name_arg, ulong SV::*offset_arg,
+ TYPELIB *typelib, sys_after_update_func func)
+ :sys_var(name_arg,func), offset(offset_arg), enum_names(typelib)
+ { chain_sys_var(chain); }
+ bool check(THD *thd, set_var *var) { return 1; }
+ bool update(THD *thd, set_var *var) { return 1; }
+ SHOW_TYPE show_type() { return SHOW_CHAR; }
+ bool check_update_type(Item_result type) { return 1; }
+ bool is_readonly() const { return 1; }
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+};
+
+
class sys_var_thd :public sys_var
{
public: