~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/create_schema.cc

  • Committer: Brian Aker
  • Date: 2010-12-18 10:14:05 UTC
  • mfrom: (2008.1.3 clean)
  • Revision ID: brian@tangent.org-20101218101405-qjbse29shi9coklg
Merge of user identifier work

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
  }
45
45
 
46
46
  SchemaIdentifier schema_identifier(string(session->lex->name.str, session->lex->name.length));
47
 
  if (not check_db_name(session, schema_identifier))
48
 
  {
49
 
    std::string path;
50
 
    schema_identifier.getSQLPath(path);
51
 
    my_error(ER_WRONG_DB_NAME, MYF(0), path.c_str());
 
47
  if (not check(schema_identifier))
52
48
    return false;
53
 
  }
54
49
 
55
50
  drizzled::message::init(schema_message, session->lex->name.str);
56
51
 
76
71
  return not res;
77
72
}
78
73
 
 
74
bool statement::CreateSchema::check(const SchemaIdentifier &identifier)
 
75
{
 
76
  if (not identifier.isValid())
 
77
    return false;
 
78
 
 
79
  if (not plugin::Authorization::isAuthorized(getSession()->user(), identifier))
 
80
    return false;
 
81
 
 
82
  if (not is_if_not_exists)
 
83
  {
 
84
    if (plugin::StorageEngine::doesSchemaExist(identifier))
 
85
    {
 
86
      std::string name;
 
87
 
 
88
      identifier.getSQLPath(name);
 
89
      my_error(ER_DB_CREATE_EXISTS, MYF(0), name.c_str());
 
90
 
 
91
      return false;
 
92
    }
 
93
  }
 
94
 
 
95
  return true;
 
96
}
 
97
 
79
98
// We don't actually test anything at this point, we assume it is all bad.
80
99
bool statement::CreateSchema::validateSchemaOptions()
81
100
{