~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-22 17:04:41 UTC
  • mfrom: (2462.1.3 drizzle-include)
  • Revision ID: me@mark.atwood.name-20111122170441-5dehm0e0ax20z19b
mergeĀ lp:~brianaker/drizzle/fedora-16-fixes

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
/**
35
40
 * Singleton instance of the plugin.
36
41
 */
37
42
static AuthSchema *auth_schema= NULL;
38
43
 
39
 
static bool update_table(Session*, set_var* var)
 
44
bool update_table(Session *, set_var *var)
40
45
{
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
 
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);
45
53
}
46
54
 
47
55
static void init_options(module::option_context &context)
61
69
    auth_schema->setTable(vm["table"].as<string>());
62
70
 
63
71
  context.add(auth_schema);
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));
 
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));
66
78
 
67
79
  return 0;
68
80
}