diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2015-02-05 13:54:55 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2015-02-05 13:54:55 +0400 |
commit | 451e9b7a50ccbced8beca81e53ae5427fac5e594 (patch) | |
tree | 6c880952219324395ac0ede7af0cc2031c55cdfe /sql/sql_plugin.cc | |
parent | b08126aad1a33ec0ad3491b061e888908d1edfe5 (diff) | |
download | mariadb-git-451e9b7a50ccbced8beca81e53ae5427fac5e594.tar.gz |
MDEV-7499 - System variables have broken default values on big endian
INFORMATION_SCHEMA.SYSTEM_VARIABLES.DEFAULT_VALUE had broken values on
big endian.
Default value is internally stored as longlong, while I_S references it's
pointer (longlong *) according to variable type (e.g. int, my_bool, etc). This
works well on little endian, but on big endian we always get 0 for such
variables.
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r-- | sql/sql_plugin.cc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 900167c1fab..30f840301ba 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -3253,7 +3253,31 @@ sys_var_pluginvar::sys_var_pluginvar(sys_var_chain *chain, const char *name_arg, uchar* sys_var_pluginvar::real_value_ptr(THD *thd, enum_var_type type) { if (type == OPT_DEFAULT) - return (uchar*)&option.def_value; + { + switch (plugin_var->flags & PLUGIN_VAR_TYPEMASK) { + case PLUGIN_VAR_BOOL: + thd->sys_var_tmp.my_bool_value= option.def_value; + return (uchar*) &thd->sys_var_tmp.my_bool_value; + case PLUGIN_VAR_INT: + thd->sys_var_tmp.int_value= option.def_value; + return (uchar*) &thd->sys_var_tmp.int_value; + case PLUGIN_VAR_LONG: + case PLUGIN_VAR_ENUM: + thd->sys_var_tmp.long_value= option.def_value; + return (uchar*) &thd->sys_var_tmp.long_value; + case PLUGIN_VAR_LONGLONG: + case PLUGIN_VAR_SET: + return (uchar*) &option.def_value; + case PLUGIN_VAR_STR: + thd->sys_var_tmp.ptr_value= (void*) option.def_value; + return (uchar*) &thd->sys_var_tmp.ptr_value; + case PLUGIN_VAR_DOUBLE: + thd->sys_var_tmp.double_value= getopt_ulonglong2double(option.def_value); + return (uchar*) &thd->sys_var_tmp.double_value; + default: + DBUG_ASSERT(0); + } + } DBUG_ASSERT(thd || (type == OPT_GLOBAL)); if (plugin_var->flags & PLUGIN_VAR_THDLOCAL) |