38
38
if (not validateSchemaOptions())
41
if (not session->endActiveTransaction())
41
if (getSession()->inTransaction())
43
my_error(ER_TRANSACTIONAL_DDL_NOT_SUPPORTED, MYF(0));
46
identifier::Schema schema_identifier(string(session->lex->name.str, session->lex->name.length));
47
identifier::Schema schema_identifier(string(getSession()->lex->name.str, getSession()->lex->name.length));
47
48
if (not check(schema_identifier))
50
drizzled::message::schema::init(schema_message, session->lex->name.str);
51
drizzled::message::schema::init(schema_message, getSession()->lex->name.str);
54
55
schema_identifier.getSQLPath(path);
56
if (unlikely(plugin::EventObserver::beforeCreateDatabase(*session, path)))
57
if (unlikely(plugin::EventObserver::beforeCreateDatabase(*getSession(), path)))
58
59
my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), path.c_str());
62
res= create_db(session, schema_message, session->getLex()->exists());
63
if (unlikely(plugin::EventObserver::afterCreateDatabase(*session, path, res)))
63
res= create_db(getSession(), schema_message, getSession()->getLex()->exists());
64
if (unlikely(plugin::EventObserver::afterCreateDatabase(*getSession(), path, res)))
65
my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), path.c_str());
66
my_error(ER_EVENT_OBSERVER_PLUGIN, schema_identifier);
79
80
if (not plugin::Authorization::isAuthorized(getSession()->user(), identifier))
82
if (not session->getLex()->exists())
83
if (not getSession()->getLex()->exists())
84
85
if (plugin::StorageEngine::doesSchemaExist(identifier))
88
identifier.getSQLPath(name);
89
my_error(ER_DB_CREATE_EXISTS, MYF(0), name.c_str());
87
my_error(ER_DB_CREATE_EXISTS, identifier);