23 #include <plugin/status_dictionary/dictionary.h>
25 #include <drizzled/pthread_globals.h>
26 #include <drizzled/internal/m_string.h>
28 #include <drizzled/status_helper.h>
29 #include <drizzled/sql_lex.h>
30 #include <drizzled/catalog/instance.h>
39 StateTool::StateTool(
const char *arg,
bool global) :
40 plugin::TableFunction(
"DATA_DICTIONARY", arg),
41 option_type(global ? OPT_GLOBAL : OPT_SESSION)
43 add_field(
"VARIABLE_NAME");
44 add_field(
"VARIABLE_VALUE", 1024);
47 StateTool::Generator::Generator(
Field **arg, sql_var_t option_arg,
drizzle_show_var *variables_args) :
48 plugin::TableFunction::Generator(arg),
49 option_type(option_arg),
50 variables(variables_args)
54 bool StateTool::Generator::populate()
56 while (variables && variables->name)
59 MY_ALIGNED_BYTE_ARRAY(buff_data, SHOW_VAR_FUNC_BUFF_SIZE, int64_t);
60 char* buff= (
char *) &buff_data;
69 for (var= variables; var->type == SHOW_FUNC; var= &tmp)
73 if (isWild(variables->name))
79 fill(variables->name, var->value, var->type);
89 void StateTool::Generator::fill(
const std::string &name,
const char *value, SHOW_TYPE show_type)
91 boost::mutex::scoped_lock lock(getSession().catalog().systemVariableLock());
93 if (show_type == SHOW_SYS)
95 show_type= ((
sys_var*) value)->show_type();
96 value= (
const char*) ((
sys_var*) value)->value_ptr(&(getSession()), option_type);
99 std::string return_value= StatusHelper::fillHelper(NULL, value, show_type);
101 push(return_value.empty() ?
" " : return_value);
TODO: Rename this file - func.h is stupid.