List:Internals« Previous MessageNext Message »
From:Davi Arnaut Date:July 12 2009 2:40am
Subject:Re: *offset question - what is it and where is it set
View as plain text  

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:


typedef struct system_variables SV;

class sys_var_thd_ha_rows :public sys_var_thd
   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 for clues.

> Implemented in one set default is in


> 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.


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;

*offset question - what is it and where is it set Joseph Lukas11 Jul
  • Re: *offset question - what is it and where is it setDavi Arnaut12 Jul
  • Re: *offset question - what is it and where is it setSergei Golubchik12 Jul
    • *offset question - what is it and where is it setJoseph Lukas12 Jul
      • Re: *offset question - what is it and where is it setSergei Golubchik13 Jul