~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/create_schema.cc

First pass on cleanup of Stewart's patch, plus re-engineer to make it work a
bit more with the current system. Engines approve key/pair.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
bool statement::CreateSchema::execute()
35
35
{
 
36
  if (not validateSchemaOptions())
 
37
    return true;
 
38
 
36
39
  if (not session->endActiveTransaction())
37
40
  {
38
41
    return true;
46
49
  }
47
50
 
48
51
  schema_message.set_name(session->lex->name.str);
 
52
  schema_message.mutable_engine()->set_name(std::string("filesystem")); // For the moment we have only one.
49
53
  if (not schema_message.has_collation())
50
54
  {
51
55
    schema_message.set_collation(default_charset_info->name);
55
59
  return not res;
56
60
}
57
61
 
 
62
// We don't actually test anything at this point, we assume it is all bad.
 
63
bool statement::CreateSchema::validateSchemaOptions()
 
64
{
 
65
  size_t num_engine_options= schema_message.engine().options_size();
 
66
  bool rc= num_engine_options ? false : true;
 
67
 
 
68
  for (size_t y= 0; y < num_engine_options; ++y)
 
69
  {
 
70
    my_error(ER_UNKNOWN_SCHEMA_OPTION, MYF(0),
 
71
             schema_message.engine().options(y).name().c_str(),
 
72
             schema_message.engine().options(y).state().c_str());
 
73
 
 
74
    rc= false;
 
75
  }
 
76
 
 
77
  return rc;
 
78
}
 
79
 
58
80
} /* namespace drizzled */
59
81