Hi!
On Jan 26, antony@stripped wrote:
> ChangeSet@stripped, 2008-01-26 15:36:22-08:00, acurtis@stripped +4 -0
> Bug#32902
> "plugin variables don't know their names"
> Implemented new plugin support function thd_plugin_var_name() to
> return the logical name of the plugin variable.
Hm, I'm thinking, whether it's the best approach or we should simply add
a pointer to the st_mysql_sys_var.
If we'll ever need to get sys_var_pluginvar from st_mysql_sys_var, a
pointer would certainly be better.
On the other hand, what else could your intern_find_sys_var() be used
for ?
> diff -Nrup a/include/mysql/plugin.h b/include/mysql/plugin.h
> --- a/include/mysql/plugin.h 2007-08-30 23:19:49 -07:00
> +++ b/include/mysql/plugin.h 2008-01-26 15:36:07 -08:00
> @@ -672,6 +672,9 @@ struct st_mysql_value
> extern "C" {
> #endif
>
> +const char *thd_plugin_var_name(MYSQL_THD thd,
> + struct st_mysql_sys_var *plugin_var);
why do you want it in include/mysql/plugin.h ?
> diff -Nrup a/sql/set_var.cc b/sql/set_var.cc
> --- a/sql/set_var.cc 2008-01-10 09:44:20 -08:00
> +++ b/sql/set_var.cc 2008-01-26 15:36:07 -08:00
> @@ -3105,6 +3105,24 @@ sys_var *intern_find_sys_var(const char
> }
>
> +sys_var *intern_find_sys_var(bool (*func)(sys_var *, void*), void *data)
> +{
> + uint index;
> +
> + /*
> + This function is only called from the sql_plugin.cc.
> + A lock on LOCK_system_variable_hash should be held
> + */
safe_malloc_assert_owner() here
> + for (index= 0; index < system_variable_hash.records; index++)
> + {
> + sys_var *var= (sys_var*) hash_element(&system_variable_hash, index);
> + if (func(var, data))
> + return var;
> + }
> + return 0;
> +}
> +
Regards / Mit vielen Grüssen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Developer
/_/ /_/\_, /___/\___\_\___/ MySQL GmbH, Dachauer Str. 37, D-80335 München
<___/ Geschäftsführer: Kaj Arnö - HRB
München 162140