23 #include <drizzled/session.h>
24 #include <drizzled/statement/alter_schema.h>
25 #include <drizzled/plugin/storage_engine.h>
26 #include <drizzled/schema.h>
27 #include <drizzled/message.h>
28 #include <drizzled/sql_lex.h>
30 #include <drizzled/catalog/instance.h>
38 bool statement::AlterSchema::execute()
40 if (not validateSchemaOptions())
46 if (not schema::check(session(), schema_identifier))
48 my_error(ER_WRONG_DB_NAME, schema_identifier);
53 message::schema::shared_ptr old_definition= plugin::StorageEngine::getSchemaDefinition(identifier);
54 if (not old_definition)
56 my_error(ER_SCHEMA_DOES_NOT_EXIST, identifier);
60 if (session().inTransaction())
62 my_error(ER_TRANSACTIONAL_DDL_NOT_SUPPORTED, MYF(0));
70 drizzled::message::schema::init(schema_message, identifier);
73 schema_message.set_version(old_definition->version());
74 schema_message.set_uuid(old_definition->uuid());
75 schema_message.mutable_engine()->set_name(old_definition->engine().name());
79 if (not schema_message.has_collation())
81 schema_message.set_collation(old_definition->collation());
84 drizzled::message::update(schema_message);
86 return not schema::alter(session(), schema_message, *old_definition);
TODO: Rename this file - func.h is stupid.