~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/create_table.h

mergeĀ lp:~hingo/drizzle/drizzle-auth_ldap-fix-and-docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems
 
4
 *  Copyright (C) 2009 Sun Microsystems, Inc.
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
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
 
{
29
 
class Session;
30
 
 
31
 
namespace statement
32
 
{
 
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
namespace statement {
33
30
 
34
31
class CreateTable : public Statement
35
32
{
36
 
  virtual bool check(const TableIdentifier&);
 
33
  virtual bool check(const identifier::Table&);
37
34
 
38
35
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)
 
36
  CreateTable(Session *in_session, Table_ident *ident, bool is_temporary);
 
37
  CreateTable(Session *in_session);
 
38
 
 
39
  virtual bool is_alter() const
45
40
  {
46
 
    memset(&create_info, 0, sizeof(create_info));
 
41
    return false;
47
42
  }
48
43
 
49
44
  bool execute();
50
 
  message::Table create_table_message;
 
45
 
 
46
  virtual bool executeInner(const identifier::Table&);
 
47
 
 
48
public:
51
49
  message::Table &createTableMessage()
52
50
  {
53
 
    return create_table_message;
 
51
    return *lex().table();
54
52
  };
55
 
  message::Table::Field *current_proto_field;
56
 
  HA_CREATE_INFO create_info;
 
53
 
 
54
private:
 
55
  HA_CREATE_INFO _create_info;
 
56
 
 
57
public:
 
58
 
 
59
  HA_CREATE_INFO &create_info()
 
60
  {
 
61
    if (createTableMessage().options().auto_increment_value())
 
62
    {
 
63
      _create_info.auto_increment_value= createTableMessage().options().auto_increment_value();
 
64
      _create_info.used_fields|= HA_CREATE_USED_AUTO;
 
65
    }
 
66
 
 
67
    return _create_info;
 
68
  }
 
69
 
57
70
  AlterInfo alter_info;
58
71
  KEY_CREATE_INFO key_create_info;
59
72
  message::Table::ForeignKeyConstraint::ForeignKeyMatchOption fk_match_option;
61
74
  message::Table::ForeignKeyConstraint::ForeignKeyOption fk_delete_opt;
62
75
 
63
76
  /* The text in a CHANGE COLUMN clause in ALTER TABLE */
64
 
  char *change;
 
77
  const char *change;
65
78
 
66
79
  /* An item representing the DEFAULT clause in CREATE/ALTER TABLE */
67
80
  Item *default_value;
69
82
  /* An item representing the ON UPDATE clause in CREATE/ALTER TABLE */
70
83
  Item *on_update_value;
71
84
 
72
 
  enum column_format_type column_format;
 
85
  column_format_type column_format;
73
86
 
74
87
  /* Poly-use */
75
 
  LEX_STRING comment;
 
88
  str_ref comment;
76
89
 
 
90
  bool is_engine_set;
77
91
  bool is_create_table_like;
78
 
  bool is_if_not_exists;
79
 
  bool is_engine_set;
 
92
  bool lex_identified_temp_table;
 
93
  bool link_to_local;
 
94
  TableList *create_table_list;
80
95
 
81
96
  bool validateCreateTableOption();
82
97
};
85
100
 
86
101
} /* namespace drizzled */
87
102
 
88
 
#endif /* DRIZZLED_STATEMENT_CREATE_TABLE_H */