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
variable.
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.
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);
}
else
{
value= &(thd->variables.*offset);
new_value= my_plugin_lock(NULL,
&(global_system_variables.*offset));
}
DBUG_ASSERT(new_value);
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.
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
frustrated.
Joe