~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-07 09:12:12 UTC
  • mto: This revision was merged to the branch mainline in revision 1985.
  • Revision ID: brian@tangent.org-20101207091212-1m0w20tck6z7632m
This is a fix for bug lp:686197

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(schema_identifier))
 
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());
48
52
    return false;
 
53
  }
49
54
 
50
55
  drizzled::message::init(schema_message, session->lex->name.str);
51
56
 
71
76
  return not res;
72
77
}
73
78
 
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
 
 
98
79
// We don't actually test anything at this point, we assume it is all bad.
99
80
bool statement::CreateSchema::validateSchemaOptions()
100
81
{