~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/create_table.h

  • Committer: Olaf van der Spek
  • Date: 2011-03-28 14:32:36 UTC
  • mto: (2257.1.1 build) (2276.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2258.
  • Revision ID: olafvdspek@gmail.com-20110328143236-4ge1d793iqaktfq0
Common fwd

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#ifndef DRIZZLED_STATEMENT_CREATE_TABLE_H
22
 
#define DRIZZLED_STATEMENT_CREATE_TABLE_H
23
 
 
24
 
#include "drizzled/statement.h"
25
 
#include "drizzled/foreign_key.h"
26
 
 
27
 
namespace drizzled
28
 
{
 
21
#pragma once
 
22
 
 
23
#include <drizzled/alter_info.h>
 
24
#include <drizzled/statement.h>
 
25
#include <drizzled/foreign_key.h>
 
26
#include <drizzled/sql_lex.h>
 
27
 
 
28
namespace drizzled {
 
29
 
29
30
class Session;
30
31
 
31
 
namespace statement
32
 
{
 
32
namespace statement {
33
33
 
34
34
class CreateTable : public Statement
35
35
{
36
 
  virtual bool check(const TableIdentifier&);
 
36
  virtual bool check(const identifier::Table&);
37
37
 
38
38
public:
39
 
  CreateTable(Session *in_session)
40
 
    :
41
 
      Statement(in_session),
42
 
      is_create_table_like(false),
43
 
      is_if_not_exists(false),
44
 
      is_engine_set(false)
 
39
  CreateTable(Session *in_session, Table_ident *ident, bool is_temporary);
 
40
  CreateTable(Session *in_session);
 
41
 
 
42
  virtual bool is_alter() const
45
43
  {
46
 
    memset(&create_info, 0, sizeof(create_info));
 
44
    return false;
47
45
  }
48
46
 
49
47
  bool execute();
50
 
  message::Table create_table_message;
 
48
 
 
49
  virtual bool executeInner(const identifier::Table&);
 
50
 
 
51
public:
51
52
  message::Table &createTableMessage()
52
53
  {
53
 
    return create_table_message;
 
54
    return *lex().table();
54
55
  };
55
 
  message::Table::Field *current_proto_field;
56
 
  HA_CREATE_INFO create_info;
 
56
 
 
57
private:
 
58
  HA_CREATE_INFO _create_info;
 
59
 
 
60
public:
 
61
 
 
62
  HA_CREATE_INFO &create_info()
 
63
  {
 
64
    if (createTableMessage().options().auto_increment_value())
 
65
    {
 
66
      _create_info.auto_increment_value= createTableMessage().options().auto_increment_value();
 
67
      _create_info.used_fields|= HA_CREATE_USED_AUTO;
 
68
    }
 
69
 
 
70
    return _create_info;
 
71
  }
 
72
 
57
73
  AlterInfo alter_info;
58
74
  KEY_CREATE_INFO key_create_info;
59
75
  message::Table::ForeignKeyConstraint::ForeignKeyMatchOption fk_match_option;
74
90
  /* Poly-use */
75
91
  LEX_STRING comment;
76
92
 
 
93
  bool is_engine_set;
77
94
  bool is_create_table_like;
78
 
  bool is_if_not_exists;
79
 
  bool is_engine_set;
 
95
  bool lex_identified_temp_table;
 
96
  bool link_to_local;
 
97
  TableList *create_table_list;
80
98
 
81
99
  bool validateCreateTableOption();
82
100
};
85
103
 
86
104
} /* namespace drizzled */
87
105
 
88
 
#endif /* DRIZZLED_STATEMENT_CREATE_TABLE_H */