24 #include <drizzled/session.h>
25 #include <drizzled/statement/drop_index.h>
26 #include <drizzled/statement/alter_table.h>
27 #include <drizzled/plugin/storage_engine.h>
28 #include <drizzled/open_tables_state.h>
35 TableList *all_tables= lex().query_tables;
38 message::table::shared_ptr original_table_message;
40 identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName());
41 if (not (original_table_message= plugin::StorageEngine::getTableMessage(session(), identifier)))
43 my_error(ER_BAD_TABLE_ERROR, identifier);
59 assert(first_table == all_tables && first_table != 0);
60 if (session().inTransaction())
62 my_error(ER_TRANSACTIONAL_DDL_NOT_SUPPORTED, MYF(0));
66 create_info.db_type= 0;
69 if (original_table_message->type() == message::Table::STANDARD )
71 identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName());
73 create_info.default_table_charset= plugin::StorageEngine::getSchemaCollation(identifier);
75 res= alter_table(&session(),
79 *original_table_message,
87 identifier::Table catch22(first_table->getSchemaName(), first_table->getTableName());
88 Table *table= session().open_tables.find_temporary_table(catch22);
91 identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName(), table->getShare()->getPath());
92 create_info.default_table_charset= plugin::StorageEngine::getSchemaCollation(identifier);
94 res= alter_table(&session(),
98 *original_table_message,