Hi,
On 7/11/09 4:37 PM, 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 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.
For example:
set_var.h:
typedef struct system_variables SV;
class sys_var_thd_ha_rows :public sys_var_thd
{
public:
ha_rows SV::*offset;
sys_var_thd_ha_rows(.., ha_rows SV::*arg) : offset(arg)
..
sys_var_thd_ha_rows foo(&vars, "max_join_size", &SV::max_join_size, ..
> 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.
Look at set_var.cc/h for clues.
> Implemented in one set default is in set_var.cc
>
[..]
>
> 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.
>
SV::*offset is a pointer to member that allows us to refer to members of
a global_system_variables instance.
The global_system_variables.*offset (.* is the bind pointer to member by
reference operator) is used to dereference the pointer to the specific
(referenced) member.
Example:
struct system_variables
{
unsigned long foo;
};
typedef struct system_variables SV;
struct system_variables global_system_variables;
unsigned long SV::*offset= &SV::foo;
global_system_variables.*offset= 5;
--