~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/auth_schema/module.cc

  • Committer: Mark Atwood
  • Date: 2011-11-23 20:58:36 UTC
  • mfrom: (2462.2.1 rf)
  • Revision ID: me@mark.atwood.name-20111123205836-6vovpscxr5h3w8qi
mergeĀ lp:~olafvdspek/drizzle/refactor12

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
namespace auth_schema {
33
33
 
34
34
/**
35
 
 * Forward declarations.
36
 
 */
37
 
bool update_table(Session *, set_var *var);
38
 
 
39
 
/**
40
35
 * Singleton instance of the plugin.
41
36
 */
42
37
static AuthSchema *auth_schema= NULL;
43
38
 
44
 
bool update_table(Session *, set_var *var)
 
39
static bool update_table(Session*, set_var* var)
45
40
{
46
 
  if (not var->value->str_value.data())
47
 
  {
48
 
    errmsg_printf(error::ERROR, _("auth_schema table cannot be NULL"));
49
 
    return true; // error
50
 
  }
51
 
  const string table(var->value->str_value.data());
52
 
  return auth_schema->setTable(table);
 
41
  if (not var->value->str_value.empty())
 
42
    return auth_schema->setTable(var->value->str_value.data());
 
43
  errmsg_printf(error::ERROR, _("auth_schema table cannot be NULL"));
 
44
  return true; // error
53
45
}
54
46
 
55
47
static void init_options(module::option_context &context)
69
61
    auth_schema->setTable(vm["table"].as<string>());
70
62
 
71
63
  context.add(auth_schema);
72
 
 
73
 
  context.registerVariable(
74
 
    new sys_var_bool_ptr("enabled", &auth_schema->sysvar_enabled));
75
 
 
76
 
  context.registerVariable(
77
 
    new sys_var_std_string("table", auth_schema->sysvar_table, NULL, &update_table));
 
64
  context.registerVariable(new sys_var_bool_ptr("enabled", &auth_schema->sysvar_enabled));
 
65
  context.registerVariable(new sys_var_std_string("table", auth_schema->sysvar_table, NULL, &update_table));
78
66
 
79
67
  return 0;
80
68
}