46
44
SchemaIdentifier schema_identifier(string(session->lex->name.str, session->lex->name.length));
47
if (not check(schema_identifier))
45
if (not check_db_name(schema_identifier))
47
my_error(ER_WRONG_DB_NAME, MYF(0), schema_identifier.getSQLPath().c_str());
50
drizzled::message::init(schema_message, session->lex->name.str);
54
schema_identifier.getSQLPath(path);
56
if (unlikely(plugin::EventObserver::beforeCreateDatabase(*session, path)))
58
my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), path.c_str());
62
res= mysql_create_db(session, schema_message, is_if_not_exists);
63
if (unlikely(plugin::EventObserver::afterCreateDatabase(*session, path, res)))
65
my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), path.c_str());
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.
53
if (not schema_message.has_collation())
55
schema_message.set_collation(default_charset_info->name);
58
bool res= mysql_create_db(session, schema_message, is_if_not_exists);
74
bool statement::CreateSchema::check(const SchemaIdentifier &identifier)
76
if (not identifier.isValid())
79
if (not plugin::Authorization::isAuthorized(getSession()->getSecurityContext(), identifier))
82
if (not is_if_not_exists)
84
if (plugin::StorageEngine::doesSchemaExist(identifier))
88
identifier.getSQLPath(name);
89
my_error(ER_DB_CREATE_EXISTS, MYF(0), name.c_str());
98
62
// We don't actually test anything at this point, we assume it is all bad.
99
63
bool statement::CreateSchema::validateSchemaOptions()