~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/get_system_var.cc

  • Committer: Olaf van der Spek
  • Date: 2011-10-26 10:23:23 UTC
  • mto: This revision was merged to the branch mainline in revision 2456.
  • Revision ID: olafvdspek@gmail.com-20111026102323-09bxs9tyqjxn3z04
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
namespace drizzled {
29
29
 
30
 
Item_func_get_system_var::
31
 
Item_func_get_system_var(sys_var *var_arg, sql_var_t var_type_arg,
32
 
                       lex_string_t *component_arg, const char *name_arg,
33
 
                       size_t name_len_arg)
34
 
  :var(var_arg), var_type(var_type_arg), component(*component_arg)
 
30
Item_func_get_system_var::Item_func_get_system_var(sys_var *var_arg, sql_var_t var_type_arg,
 
31
                       lex_string_t *component_arg, const char *name_arg, size_t name_len_arg)
 
32
  : var(var_arg), var_type(var_type_arg), component(*component_arg)
35
33
{
36
34
  /* set_name() will allocate the name */
37
35
  set_name(name_arg, name_len_arg);
38
36
}
39
37
 
40
38
 
41
 
bool
42
 
Item_func_get_system_var::fix_fields(Session *session, Item **ref)
 
39
bool Item_func_get_system_var::fix_fields(Session *session, Item **ref)
43
40
{
44
41
 
45
42
  /*
57
54
  return 0;
58
55
}
59
56
 
60
 
Item *get_system_var(Session *session, sql_var_t var_type, lex_string_t name,
61
 
                     lex_string_t component)
 
57
Item *get_system_var(Session *session, sql_var_t var_type, lex_string_t name, lex_string_t component)
62
58
{
63
 
  sys_var *var;
64
59
  lex_string_t *base_name, *component_name;
65
60
 
66
61
  if (component.data())
74
69
    component_name= &component;                 // Empty string
75
70
  }
76
71
 
77
 
  if (!(var= find_sys_var(base_name->data())))
78
 
    return 0;
 
72
  sys_var *var= find_sys_var(base_name->data());
 
73
  if (not var)
 
74
    return NULL;
79
75
  if (component.data())
80
76
  {
81
77
    my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), base_name->data());
82
 
    return 0;
 
78
    return NULL;
83
79
  }
84
80
  session->lex().setCacheable(false);
85
81