00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #pragma once
00022
00023 #include <drizzled/alter_info.h>
00024 #include <drizzled/statement.h>
00025 #include <drizzled/foreign_key.h>
00026 #include <drizzled/sql_lex.h>
00027
00028 namespace drizzled {
00029 namespace statement {
00030
00031 class CreateTable : public Statement
00032 {
00033 virtual bool check(const identifier::Table&);
00034
00035 public:
00036 CreateTable(Session *in_session, Table_ident *ident, bool is_temporary);
00037 CreateTable(Session *in_session);
00038
00039 virtual bool is_alter() const
00040 {
00041 return false;
00042 }
00043
00044 bool execute();
00045
00046 virtual bool executeInner(const identifier::Table&);
00047
00048 public:
00049 message::Table &createTableMessage()
00050 {
00051 return *lex().table();
00052 };
00053
00054 private:
00055 HA_CREATE_INFO _create_info;
00056
00057 public:
00058
00059 HA_CREATE_INFO &create_info()
00060 {
00061 if (createTableMessage().options().auto_increment_value())
00062 {
00063 _create_info.auto_increment_value= createTableMessage().options().auto_increment_value();
00064 _create_info.used_fields|= HA_CREATE_USED_AUTO;
00065 }
00066
00067 return _create_info;
00068 }
00069
00070 AlterInfo alter_info;
00071 KEY_CREATE_INFO key_create_info;
00072 message::Table::ForeignKeyConstraint::ForeignKeyMatchOption fk_match_option;
00073 message::Table::ForeignKeyConstraint::ForeignKeyOption fk_update_opt;
00074 message::Table::ForeignKeyConstraint::ForeignKeyOption fk_delete_opt;
00075
00076
00077 const char *change;
00078
00079
00080 Item *default_value;
00081
00082
00083 Item *on_update_value;
00084
00085 column_format_type column_format;
00086
00087
00088 str_ref comment;
00089
00090 bool is_engine_set;
00091 bool is_create_table_like;
00092 bool lex_identified_temp_table;
00093 bool link_to_local;
00094 TableList *create_table_list;
00095
00096 bool validateCreateTableOption();
00097 };
00098
00099 }
00100
00101 }
00102