=== modified file 'include/mysql/plugin.h' --- include/mysql/plugin.h 2008-03-07 21:46:29 +0000 +++ include/mysql/plugin.h 2009-02-11 19:09:32 +0000 @@ -168,7 +168,7 @@ struct st_mysql_value; */ typedef int (*mysql_var_check_func)(MYSQL_THD thd, - struct st_mysql_sys_var *var, + class sys_var_pluginvar *var, void *save, struct st_mysql_value *value); /* @@ -186,7 +186,7 @@ typedef int (*mysql_var_check_func)(MYSQ For example, strings may require memory to be allocated. */ typedef void (*mysql_var_update_func)(MYSQL_THD thd, - struct st_mysql_sys_var *var, + class sys_var_pluginvar *var, void *var_ptr, const void *save); === modified file 'mysql-test/r/plugin.result' --- mysql-test/r/plugin.result 2008-02-24 13:12:17 +0000 +++ mysql-test/r/plugin.result 2009-02-11 19:18:06 +0000 @@ -25,7 +25,7 @@ INSTALL PLUGIN example SONAME 'ha_exampl SET GLOBAL example_enum_var= e1; SET GLOBAL example_enum_var= e2; SET GLOBAL example_enum_var= impossible; -ERROR 42000: Variable 'enum_var' can't be set to the value of 'impossible' +ERROR 42000: Variable 'example_enum_var' can't be set to the value of 'impossible' UNINSTALL PLUGIN example; INSTALL PLUGIN example SONAME 'ha_example.so'; select @@session.sql_mode into @old_sql_mode; @@ -36,7 +36,7 @@ select @@global.example_ulong_var; 500 set global example_ulong_var=1111; Warnings: -Warning 1292 Truncated incorrect ulong_var value: '1111' +Warning 1292 Truncated incorrect example_ulong_var value: '1111' select @@global.example_ulong_var; @@global.example_ulong_var 1000 @@ -46,7 +46,7 @@ select @@global.example_ulong_var; @@global.example_ulong_var 500 set global example_ulong_var=1111; -ERROR 42000: Variable 'ulong_var' can't be set to the value of '1111' +ERROR 42000: Variable 'example_ulong_var' can't be set to the value of '1111' select @@global.example_ulong_var; @@global.example_ulong_var 500 === modified file 'sql/sql_plugin.cc' --- sql/sql_plugin.cc 2009-02-09 15:03:52 +0000 +++ sql/sql_plugin.cc 2009-02-11 19:16:41 +0000 @@ -1871,7 +1871,7 @@ typedef uchar *(*mysql_sys_var_ptr_p)(vo default variable data check and update functions ****************************************************************************/ -static int check_func_bool(THD *thd, struct st_mysql_sys_var *var, +static int check_func_bool(THD *thd, sys_var_pluginvar *var, void *save, st_mysql_value *value) { char buff[STRING_BUFFER_USUAL_SIZE]; @@ -1910,66 +1910,66 @@ err: } -static int check_func_int(THD *thd, struct st_mysql_sys_var *var, +static int check_func_int(THD *thd, sys_var_pluginvar *var, void *save, st_mysql_value *value) { my_bool fixed; long long tmp; struct my_option options; value->val_int(value, &tmp); - plugin_opt_set_limits(&options, var); + plugin_opt_set_limits(&options, var->plugin_var); - if (var->flags & PLUGIN_VAR_UNSIGNED) + if (var->plugin_var->flags & PLUGIN_VAR_UNSIGNED) *(uint *)save= (uint) getopt_ull_limit_value((ulonglong) tmp, &options, &fixed); else *(int *)save= (int) getopt_ll_limit_value(tmp, &options, &fixed); - return throw_bounds_warning(thd, fixed, var->flags & PLUGIN_VAR_UNSIGNED, + return throw_bounds_warning(thd, fixed, var->plugin_var->flags & PLUGIN_VAR_UNSIGNED, var->name, (longlong) tmp); } -static int check_func_long(THD *thd, struct st_mysql_sys_var *var, +static int check_func_long(THD *thd, sys_var_pluginvar *var, void *save, st_mysql_value *value) { my_bool fixed; long long tmp; struct my_option options; value->val_int(value, &tmp); - plugin_opt_set_limits(&options, var); + plugin_opt_set_limits(&options, var->plugin_var); - if (var->flags & PLUGIN_VAR_UNSIGNED) + if (var->plugin_var->flags & PLUGIN_VAR_UNSIGNED) *(ulong *)save= (ulong) getopt_ull_limit_value((ulonglong) tmp, &options, &fixed); else *(long *)save= (long) getopt_ll_limit_value(tmp, &options, &fixed); - return throw_bounds_warning(thd, fixed, var->flags & PLUGIN_VAR_UNSIGNED, + return throw_bounds_warning(thd, fixed, var->plugin_var->flags & PLUGIN_VAR_UNSIGNED, var->name, (longlong) tmp); } -static int check_func_longlong(THD *thd, struct st_mysql_sys_var *var, +static int check_func_longlong(THD *thd, sys_var_pluginvar *var, void *save, st_mysql_value *value) { my_bool fixed; long long tmp; struct my_option options; value->val_int(value, &tmp); - plugin_opt_set_limits(&options, var); + plugin_opt_set_limits(&options, var->plugin_var); - if (var->flags & PLUGIN_VAR_UNSIGNED) + if (var->plugin_var->flags & PLUGIN_VAR_UNSIGNED) *(ulonglong *)save= getopt_ull_limit_value((ulonglong) tmp, &options, &fixed); else *(longlong *)save= getopt_ll_limit_value(tmp, &options, &fixed); - return throw_bounds_warning(thd, fixed, var->flags & PLUGIN_VAR_UNSIGNED, + return throw_bounds_warning(thd, fixed, var->plugin_var->flags & PLUGIN_VAR_UNSIGNED, var->name, (longlong) tmp); } -static int check_func_str(THD *thd, struct st_mysql_sys_var *var, +static int check_func_str(THD *thd, sys_var_pluginvar *var, void *save, st_mysql_value *value) { char buff[STRING_BUFFER_USUAL_SIZE]; @@ -1984,7 +1984,7 @@ static int check_func_str(THD *thd, stru } -static int check_func_enum(THD *thd, struct st_mysql_sys_var *var, +static int check_func_enum(THD *thd, sys_var_pluginvar *var, void *save, st_mysql_value *value) { char buff[STRING_BUFFER_USUAL_SIZE]; @@ -1994,10 +1994,10 @@ static int check_func_enum(THD *thd, str long result; int length; - if (var->flags & PLUGIN_VAR_THDLOCAL) - typelib= ((thdvar_enum_t*) var)->typelib; + if (var->plugin_var->flags & PLUGIN_VAR_THDLOCAL) + typelib= ((thdvar_enum_t*) var->plugin_var)->typelib; else - typelib= ((sysvar_enum_t*) var)->typelib; + typelib= ((sysvar_enum_t*) var->plugin_var)->typelib; if (value->value_type(value) == MYSQL_VALUE_TYPE_STRING) { @@ -2030,7 +2030,7 @@ err: } -static int check_func_set(THD *thd, struct st_mysql_sys_var *var, +static int check_func_set(THD *thd, sys_var_pluginvar *var, void *save, st_mysql_value *value) { char buff[STRING_BUFFER_USUAL_SIZE], *error= 0; @@ -2041,7 +2041,7 @@ static int check_func_set(THD *thd, stru bool not_used; int length; - if (var->flags & PLUGIN_VAR_THDLOCAL) + if (var->plugin_var->flags & PLUGIN_VAR_THDLOCAL) typelib= ((thdvar_set_t*) var)->typelib; else typelib= ((sysvar_set_t*)var)->typelib; @@ -2080,40 +2080,40 @@ err: } -static void update_func_bool(THD *thd, struct st_mysql_sys_var *var, +static void update_func_bool(THD *thd, sys_var_pluginvar *var, void *tgt, const void *save) { *(my_bool *) tgt= *(my_bool *) save ? TRUE : FALSE; } -static void update_func_int(THD *thd, struct st_mysql_sys_var *var, +static void update_func_int(THD *thd, sys_var_pluginvar *var, void *tgt, const void *save) { *(int *)tgt= *(int *) save; } -static void update_func_long(THD *thd, struct st_mysql_sys_var *var, +static void update_func_long(THD *thd, sys_var_pluginvar *var, void *tgt, const void *save) { *(long *)tgt= *(long *) save; } -static void update_func_longlong(THD *thd, struct st_mysql_sys_var *var, +static void update_func_longlong(THD *thd, sys_var_pluginvar *var, void *tgt, const void *save) { *(longlong *)tgt= *(ulonglong *) save; } -static void update_func_str(THD *thd, struct st_mysql_sys_var *var, +static void update_func_str(THD *thd, sys_var_pluginvar *var, void *tgt, const void *save) { char *old= *(char **) tgt; *(char **)tgt= *(char **) save; - if (var->flags & PLUGIN_VAR_MEMALLOC) + if (var->plugin_var->flags & PLUGIN_VAR_MEMALLOC) { *(char **)tgt= my_strdup(*(char **) save, MYF(0)); my_free(old, MYF(0)); @@ -2660,7 +2660,7 @@ bool sys_var_pluginvar::check(THD *thd, value.item= var->value; return is_readonly() || - plugin_var->check(thd, plugin_var, &var->save_result, &value); + plugin_var->check(thd, this, &var->save_result, &value); } @@ -2716,13 +2716,13 @@ void sys_var_pluginvar::set_default(THD if (!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) || type == OPT_GLOBAL) { - plugin_var->update(thd, plugin_var, tgt, src); + plugin_var->update(thd, this, tgt, src); pthread_mutex_unlock(&LOCK_global_system_variables); } else { pthread_mutex_unlock(&LOCK_global_system_variables); - plugin_var->update(thd, plugin_var, tgt, src); + plugin_var->update(thd, this, tgt, src); } } @@ -2746,13 +2746,13 @@ bool sys_var_pluginvar::update(THD *thd, if (!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) || var->type == OPT_GLOBAL) { /* variable we are updating has global scope, so we unlock after updating */ - plugin_var->update(thd, plugin_var, tgt, &var->save_result); + plugin_var->update(thd, this, tgt, &var->save_result); pthread_mutex_unlock(&LOCK_global_system_variables); } else { pthread_mutex_unlock(&LOCK_global_system_variables); - plugin_var->update(thd, plugin_var, tgt, &var->save_result); + plugin_var->update(thd, this, tgt, &var->save_result); } return 0; }