22#include <plugin/show_dictionary/dictionary.h>
23#include <drizzled/identifier.h>
24#include <drizzled/message.h>
26#include <google/protobuf/text_format.h>
27#include <drizzled/plugin/authorization.h>
33ShowCreateTable::ShowCreateTable() :
34 show_dictionary::Show(
"TABLE_SQL_DEFINITION")
36 add_field(
"TABLE_NAME", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH,
false);
37 add_field(
"TABLE_SQL_DEFINITION", plugin::TableFunction::STRING, TABLE_FUNCTION_BLOB_SIZE,
false);
40ShowCreateTable::Generator::Generator(
Field **arg) :
41 show_dictionary::Show::Generator(arg),
44 if (not isShowQuery())
49 if (not select.getShowTable().empty() && not select.getShowSchema().empty())
51 identifier::Table identifier(getSession().catalog().identifier(),
52 select.getShowSchema(),
53 select.getShowTable());
55 if (not plugin::Authorization::isAuthorized(*getSession().user(),
58 drizzled::error::access(*getSession().user(), identifier);
62 table_message= plugin::StorageEngine::getTableMessage(getSession(),
67 else if (not getSession().is_error())
68 my_error(ER_BAD_TABLE_ERROR, identifier);
72bool ShowCreateTable::Generator::populate()
79 std::string create_sql;
80 transform_err= message::transformTableDefinitionToSql(*table_message,
84 if (transform_err != drizzled::message::NONE)
89 push(table_message->name());
TODO: Rename this file - func.h is stupid.