Commit eba20793 authored by unknown's avatar unknown

WL#2936

  Change SET variables to be ulonglong type (64bit)


include/mysql/plugin.h:
  WL2936
    Change SET variables to be unsigned long long type
    Changed use of ulonglong to unsigned long long
sql/sql_plugin.cc:
  WL2936
    Change SET variables to be ulonglong type (64bit)
parent 81c32c1e
...@@ -203,9 +203,9 @@ typedef void (*mysql_var_update_func)(MYSQL_THD thd, ...@@ -203,9 +203,9 @@ typedef void (*mysql_var_update_func)(MYSQL_THD thd,
type blk_sz; \ type blk_sz; \
} MYSQL_SYSVAR_NAME(name) } MYSQL_SYSVAR_NAME(name)
#define DECLARE_MYSQL_SYSVAR_TYPELIB(name) struct { \ #define DECLARE_MYSQL_SYSVAR_TYPELIB(name, type) struct { \
MYSQL_PLUGIN_VAR_HEADER; \ MYSQL_PLUGIN_VAR_HEADER; \
unsigned long *value, def_val;\ type *value; type def_val; \
TYPELIB *typelib; \ TYPELIB *typelib; \
} MYSQL_SYSVAR_NAME(name) } MYSQL_SYSVAR_NAME(name)
...@@ -227,11 +227,11 @@ typedef void (*mysql_var_update_func)(MYSQL_THD thd, ...@@ -227,11 +227,11 @@ typedef void (*mysql_var_update_func)(MYSQL_THD thd,
DECLARE_THDVAR_FUNC(type); \ DECLARE_THDVAR_FUNC(type); \
} MYSQL_SYSVAR_NAME(name) } MYSQL_SYSVAR_NAME(name)
#define DECLARE_MYSQL_THDVAR_TYPELIB(name) struct { \ #define DECLARE_MYSQL_THDVAR_TYPELIB(name, type) struct { \
MYSQL_PLUGIN_VAR_HEADER; \ MYSQL_PLUGIN_VAR_HEADER; \
int offset; \ int offset; \
unsigned long def_val; \ type def_val; \
DECLARE_THDVAR_FUNC(unsigned long); \ DECLARE_THDVAR_FUNC(type); \
TYPELIB *typelib; \ TYPELIB *typelib; \
} MYSQL_SYSVAR_NAME(name) } MYSQL_SYSVAR_NAME(name)
...@@ -271,22 +271,22 @@ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long) = { \ ...@@ -271,22 +271,22 @@ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long) = { \
#name, comment, check, update, &varname, def, min, max, blk } #name, comment, check, update, &varname, def, min, max, blk }
#define MYSQL_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \ #define MYSQL_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
DECLARE_MYSQL_SYSVAR_SIMPLE(name, longlong) = { \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, long long) = { \
PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \ PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, min, max, blk } #name, comment, check, update, &varname, def, min, max, blk }
#define MYSQL_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \ #define MYSQL_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
DECLARE_MYSQL_SYSVAR_SIMPLE(name, ulonglong) = { \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long long) = { \
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, min, max, blk } #name, comment, check, update, &varname, def, min, max, blk }
#define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \ #define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
DECLARE_MYSQL_SYSVAR_TYPELIB(name) = { \ DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \
PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \ PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, typelib } #name, comment, check, update, &varname, def, typelib }
#define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \ #define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \
DECLARE_MYSQL_SYSVAR_TYPELIB(name) = { \ DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long long) = { \
PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \ PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, typelib } #name, comment, check, update, &varname, def, typelib }
...@@ -321,22 +321,22 @@ DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long) = { \ ...@@ -321,22 +321,22 @@ DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long) = { \
#name, comment, check, update, -1, def, min, max, blk, NULL } #name, comment, check, update, -1, def, min, max, blk, NULL }
#define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \ #define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
DECLARE_MYSQL_THDVAR_SIMPLE(name, longlong) = { \ DECLARE_MYSQL_THDVAR_SIMPLE(name, long long) = { \
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, min, max, blk, NULL } #name, comment, check, update, -1, def, min, max, blk, NULL }
#define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \ #define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
DECLARE_MYSQL_THDVAR_SIMPLE(name, ulonglong) = { \ DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long long) = { \
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, min, max, blk, NULL } #name, comment, check, update, -1, def, min, max, blk, NULL }
#define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \ #define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \
DECLARE_MYSQL_THDVAR_TYPELIB(name) = { \ DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long) = { \
PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, NULL, typelib } #name, comment, check, update, -1, def, NULL, typelib }
#define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \ #define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \
DECLARE_MYSQL_THDVAR_TYPELIB(name) = { \ DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long long) = { \
PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, NULL, typelib } #name, comment, check, update, -1, def, NULL, typelib }
......
...@@ -1767,8 +1767,10 @@ typedef DECLARE_MYSQL_THDVAR_BASIC(thdvar_bool_t, my_bool); ...@@ -1767,8 +1767,10 @@ typedef DECLARE_MYSQL_THDVAR_BASIC(thdvar_bool_t, my_bool);
typedef DECLARE_MYSQL_SYSVAR_BASIC(sysvar_str_t, char *); typedef DECLARE_MYSQL_SYSVAR_BASIC(sysvar_str_t, char *);
typedef DECLARE_MYSQL_THDVAR_BASIC(thdvar_str_t, char *); typedef DECLARE_MYSQL_THDVAR_BASIC(thdvar_str_t, char *);
typedef DECLARE_MYSQL_SYSVAR_TYPELIB(sysvar_typelib_t); typedef DECLARE_MYSQL_SYSVAR_TYPELIB(sysvar_enum_t, unsigned long);
typedef DECLARE_MYSQL_THDVAR_TYPELIB(thdvar_typelib_t); typedef DECLARE_MYSQL_THDVAR_TYPELIB(thdvar_enum_t, unsigned long);
typedef DECLARE_MYSQL_SYSVAR_TYPELIB(sysvar_set_t, ulonglong);
typedef DECLARE_MYSQL_THDVAR_TYPELIB(thdvar_set_t, ulonglong);
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_int_t, int); typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_int_t, int);
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_long_t, long); typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_long_t, long);
...@@ -1896,9 +1898,9 @@ static int check_func_enum(THD *thd, struct st_mysql_sys_var *var, ...@@ -1896,9 +1898,9 @@ static int check_func_enum(THD *thd, struct st_mysql_sys_var *var,
int length; int length;
if (var->flags & PLUGIN_VAR_THDLOCAL) if (var->flags & PLUGIN_VAR_THDLOCAL)
typelib= ((thdvar_typelib_t*) var)->typelib; typelib= ((thdvar_enum_t*) var)->typelib;
else else
typelib= ((sysvar_typelib_t*) var)->typelib; typelib= ((sysvar_enum_t*) var)->typelib;
if (value->value_type(value) == MYSQL_VALUE_TYPE_STRING) if (value->value_type(value) == MYSQL_VALUE_TYPE_STRING)
{ {
...@@ -1944,9 +1946,9 @@ static int check_func_set(THD *thd, struct st_mysql_sys_var *var, ...@@ -1944,9 +1946,9 @@ static int check_func_set(THD *thd, struct st_mysql_sys_var *var,
int length; int length;
if (var->flags & PLUGIN_VAR_THDLOCAL) if (var->flags & PLUGIN_VAR_THDLOCAL)
typelib= ((thdvar_typelib_t*) var)->typelib; typelib= ((thdvar_set_t*) var)->typelib;
else else
typelib= ((sysvar_typelib_t*)var)->typelib; typelib= ((sysvar_set_t*)var)->typelib;
if (value->value_type(value) == MYSQL_VALUE_TYPE_STRING) if (value->value_type(value) == MYSQL_VALUE_TYPE_STRING)
{ {
...@@ -2487,13 +2489,17 @@ byte* sys_var_pluginvar::real_value_ptr(THD *thd, enum_var_type type) ...@@ -2487,13 +2489,17 @@ byte* sys_var_pluginvar::real_value_ptr(THD *thd, enum_var_type type)
TYPELIB* sys_var_pluginvar::plugin_var_typelib(void) TYPELIB* sys_var_pluginvar::plugin_var_typelib(void)
{ {
int type= plugin_var->flags & PLUGIN_VAR_TYPEMASK; switch (plugin_var->flags & (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_THDLOCAL)) {
if (type == PLUGIN_VAR_ENUM || type == PLUGIN_VAR_SET) case PLUGIN_VAR_ENUM:
{ return ((sysvar_enum_t *)plugin_var)->typelib;
if (plugin_var->flags & PLUGIN_VAR_THDLOCAL) case PLUGIN_VAR_SET:
return ((thdvar_typelib_t *)plugin_var)->typelib; return ((sysvar_set_t *)plugin_var)->typelib;
else case PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL:
return ((sysvar_typelib_t *)plugin_var)->typelib; return ((thdvar_enum_t *)plugin_var)->typelib;
case PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL:
return ((thdvar_set_t *)plugin_var)->typelib;
default:
return NULL;
} }
return NULL; return NULL;
} }
...@@ -2514,7 +2520,7 @@ byte* sys_var_pluginvar::value_ptr(THD *thd, enum_var_type type, ...@@ -2514,7 +2520,7 @@ byte* sys_var_pluginvar::value_ptr(THD *thd, enum_var_type type,
char buffer[STRING_BUFFER_USUAL_SIZE]; char buffer[STRING_BUFFER_USUAL_SIZE];
String str(buffer, sizeof(buffer), system_charset_info); String str(buffer, sizeof(buffer), system_charset_info);
TYPELIB *typelib= plugin_var_typelib(); TYPELIB *typelib= plugin_var_typelib();
ulong mask= 1, value= *(ulong*) result; ulonglong mask= 1, value= *(ulonglong*) result;
uint i; uint i;
str.length(0); str.length(0);
...@@ -2649,15 +2655,15 @@ static void plugin_opt_set_limits(struct my_option *options, ...@@ -2649,15 +2655,15 @@ static void plugin_opt_set_limits(struct my_option *options,
break; break;
case PLUGIN_VAR_ENUM: case PLUGIN_VAR_ENUM:
options->var_type= GET_ENUM; options->var_type= GET_ENUM;
options->typelib= ((sysvar_typelib_t*) opt)->typelib; options->typelib= ((sysvar_enum_t*) opt)->typelib;
options->def_value= *(ulong*) ((int*) (opt + 1) + 1); options->def_value= *(ulong*) ((int*) (opt + 1) + 1);
options->min_value= options->block_size= 0; options->min_value= options->block_size= 0;
options->max_value= options->typelib->count - 1; options->max_value= options->typelib->count - 1;
break; break;
case PLUGIN_VAR_SET: case PLUGIN_VAR_SET:
options->var_type= GET_SET; options->var_type= GET_SET;
options->typelib= ((sysvar_typelib_t*) opt)->typelib; options->typelib= ((sysvar_set_t*) opt)->typelib;
options->def_value= *(ulong*) ((int*) (opt + 1) + 1); options->def_value= *(ulonglong*) ((int*) (opt + 1) + 1);
options->min_value= options->block_size= 0; options->min_value= options->block_size= 0;
options->max_value= (ULL(1) << options->typelib->count) - 1; options->max_value= (ULL(1) << options->typelib->count) - 1;
break; break;
...@@ -2691,15 +2697,15 @@ static void plugin_opt_set_limits(struct my_option *options, ...@@ -2691,15 +2697,15 @@ static void plugin_opt_set_limits(struct my_option *options,
break; break;
case PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL: case PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL:
options->var_type= GET_ENUM; options->var_type= GET_ENUM;
options->typelib= ((thdvar_typelib_t*) opt)->typelib; options->typelib= ((thdvar_enum_t*) opt)->typelib;
options->def_value= *(ulong*) ((int*) (opt + 1) + 1); options->def_value= *(ulong*) ((int*) (opt + 1) + 1);
options->min_value= options->block_size= 0; options->min_value= options->block_size= 0;
options->max_value= options->typelib->count - 1; options->max_value= options->typelib->count - 1;
break; break;
case PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL: case PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL:
options->var_type= GET_SET; options->var_type= GET_SET;
options->typelib= ((thdvar_typelib_t*) opt)->typelib; options->typelib= ((thdvar_set_t*) opt)->typelib;
options->def_value= *(ulong*) ((int*) (opt + 1) + 1); options->def_value= *(ulonglong*) ((int*) (opt + 1) + 1);
options->min_value= options->block_size= 0; options->min_value= options->block_size= 0;
options->max_value= (ULL(1) << options->typelib->count) - 1; options->max_value= (ULL(1) << options->typelib->count) - 1;
break; break;
...@@ -2816,8 +2822,10 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp, ...@@ -2816,8 +2822,10 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
SET_PLUGIN_VAR_RESOLVE((thdvar_str_t *) opt); SET_PLUGIN_VAR_RESOLVE((thdvar_str_t *) opt);
break; break;
case PLUGIN_VAR_ENUM: case PLUGIN_VAR_ENUM:
SET_PLUGIN_VAR_RESOLVE((thdvar_enum_t *) opt);
break;
case PLUGIN_VAR_SET: case PLUGIN_VAR_SET:
SET_PLUGIN_VAR_RESOLVE((thdvar_typelib_t *) opt); SET_PLUGIN_VAR_RESOLVE((thdvar_set_t *) opt);
break; break;
default: default:
sql_print_error("Unknown variable type code 0x%x in plugin '%s'.", sql_print_error("Unknown variable type code 0x%x in plugin '%s'.",
......
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