~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/context.cc

merge READ COMMITTED bug fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "drizzled/module/option_map.h"
23
23
#include "drizzled/module/module.h"
24
24
#include "drizzled/drizzled.h"
 
25
#include "drizzled/set_var.h"
25
26
 
26
27
namespace drizzled
27
28
{
34
35
  return module::option_map(module->getName(), getVariablesMap());
35
36
}
36
37
 
 
38
void Context::registerVariable(sys_var *var)
 
39
{
 
40
  var->setName(prepend_name(module->getName(), var->getName()));
 
41
  module->addMySysVar(var);
 
42
  add_sys_var_to_list(var);
 
43
}
 
44
 
 
45
namespace
 
46
{
 
47
 
 
48
class SwapDashes
 
49
{
 
50
public:
 
51
  char operator()(char a) const
 
52
  {
 
53
    if (a == '-')
 
54
      return '_';
 
55
    return a;
 
56
  }
 
57
};
 
58
 
 
59
} /* namespace */
 
60
 
 
61
std::string Context::prepend_name(std::string module_name,
 
62
                                  const std::string &var_name)
 
63
{
 
64
  module_name.push_back('_');
 
65
  module_name.append(var_name);
 
66
  std::transform(module_name.begin(), module_name.end(),
 
67
                 module_name.begin(), SwapDashes());
 
68
  std::transform(module_name.begin(), module_name.end(),
 
69
                 module_name.begin(), ::tolower);
 
70
  return module_name;
 
71
}
 
72
 
 
73
 
37
74
} /* namespace module */
38
75
} /* namespace drizzled */