On Jul 11, Joseph Lukas wrote:
> Ok so I think I found how to get the value for the variables as
> currently set. However I am having trouble getting it to get the
> In looking at the set_default which gets the global_system_variable
> value I cannot find anywhere what *offset is nor any place it is
> defined. I tried a search of all files in the MySQL repository folder
> but with 631 different possible files is a little bit hard.
> What I want to do is have set function check if the variable is valid
> then use thd->variables.<variable> to get the value. As in searching
> this is the location of system variables for the session. I looked at
> the definition and it does not help that the names are a little
> different. Such as sort_buffer_size is sortbuffer_size in the struct
> for the variables.
if you look at how SET @@variable= is parsed in sql_yacc.yy, you'll find
the function to check if the variable is valid.
> Implemented in one set default is in set_var.cc
> void sys_var_thd_storage_engine::set_default(THD *thd, enum_var_type type)
> plugin_ref old_value, new_value, *value;
> if (type == OPT_GLOBAL)
> value= &(global_system_variables.*offset);
> new_value= ha_lock_engine(NULL, myisam_hton);
> value= &(thd->variables.*offset);
> new_value= my_plugin_lock(NULL, &(global_system_variables.*offset));
> old_value= *value;
> *value= new_value;
> plugin_unlock(NULL, old_value);
> If I can use *offset in the same way in another file I should have no
> problem but I have to know what the *offset is defined as and how it
> sets to the proper variable.
You cannot use *offset, it's not even public in some classes.
You should use public methods like check(), uppate(), and set_default().
> Can somebody please help explain where *offset is setup or how it
> works above? This is my current set back and I am getting very
Please, don't invent new ways to bypass the interface, SET is already
implemented, use the existing functions and solutions.
Regards / Mit vielen Grüßen,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect
/_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028
<___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring