1100.3.65
by Padraig O'Sullivan
Extracted the CREATE TABLE command into its own class and implementation |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
4 |
* Copyright (C) 2009 Sun Microsystems, Inc.
|
1100.3.65
by Padraig O'Sullivan
Extracted the CREATE TABLE command into its own class and implementation |
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; either version 2 of the License, or
|
|
9 |
* (at your option) any later version.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program; if not, write to the Free Software
|
|
18 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19 |
*/
|
|
20 |
||
2234
by Brian Aker
Mass removal of ifdef/endif in favor of pragma once. |
21 |
#pragma once
|
1100.3.65
by Padraig O'Sullivan
Extracted the CREATE TABLE command into its own class and implementation |
22 |
|
2198.1.1
by Olaf van der Spek
Remove unnecessary alter* includes |
23 |
#include <drizzled/alter_info.h> |
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
24 |
#include <drizzled/statement.h> |
25 |
#include <drizzled/foreign_key.h> |
|
2234.1.4
by Olaf van der Spek
Refactor includes |
26 |
#include <drizzled/sql_lex.h> |
27 |
||
28 |
namespace drizzled { |
|
29 |
namespace statement { |
|
1100.3.65
by Padraig O'Sullivan
Extracted the CREATE TABLE command into its own class and implementation |
30 |
|
31 |
class CreateTable : public Statement |
|
32 |
{
|
|
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
33 |
virtual bool check(const identifier::Table&); |
1992.4.1
by Brian Aker
Update code for testing identifiers/table/schema name correctness. |
34 |
|
1100.3.65
by Padraig O'Sullivan
Extracted the CREATE TABLE command into its own class and implementation |
35 |
public: |
2096.1.3
by Brian Aker
Have table name added in as early as possible. |
36 |
CreateTable(Session *in_session, Table_ident *ident, bool is_temporary); |
37 |
CreateTable(Session *in_session); |
|
2029.1.1
by Brian Aker
Merge in first pass. |
38 |
|
39 |
virtual bool is_alter() const |
|
40 |
{
|
|
41 |
return false; |
|
1128.2.3
by Brian Aker
Remove create_info from global |
42 |
}
|
1100.3.65
by Padraig O'Sullivan
Extracted the CREATE TABLE command into its own class and implementation |
43 |
|
44 |
bool execute(); |
|
2140.2.6
by Stewart Smith
be sure to start a transaction with a startTransaction call on the first statement when autocommit is OFF. The only statements that DO NOT do this are a) DDL and b) SELECT without a table (e.g. SELECT DATABASE() and SHOW STATUS. |
45 |
|
2246.4.10
by Olaf van der Spek
Remove const_reference and reference from identifier::Table |
46 |
virtual bool executeInner(const identifier::Table&); |
2029.1.1
by Brian Aker
Merge in first pass. |
47 |
|
2029.1.2
by Brian Aker
Merge in refactor of LIKE up to its own calling pointer in the parser. |
48 |
public: |
1372.1.3
by Brian Aker
Refactor for table message. |
49 |
message::Table &createTableMessage() |
50 |
{
|
|
2224.2.8
by Olaf van der Spek
Statement::lex() |
51 |
return *lex().table(); |
1372.1.3
by Brian Aker
Refactor for table message. |
52 |
};
|
2029.1.20
by Brian Aker
Make use of lex for its pointer for field creation. |
53 |
|
2029.1.2
by Brian Aker
Merge in refactor of LIKE up to its own calling pointer in the parser. |
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 |
||
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
70 |
AlterInfo alter_info; |
1128.2.9
by Brian Aker
Remove KEY_CREATE_INFO from global lex. |
71 |
KEY_CREATE_INFO key_create_info; |
1638.9.2
by Stewart Smith
use the ENUM in the table proto instead of duplicating it for Foreign key options and match option. A move in the direction of just having foreign keys in the proto |
72 |
message::Table::ForeignKeyConstraint::ForeignKeyMatchOption fk_match_option; |
73 |
message::Table::ForeignKeyConstraint::ForeignKeyOption fk_update_opt; |
|
74 |
message::Table::ForeignKeyConstraint::ForeignKeyOption fk_delete_opt; |
|
1128.2.11
by Brian Aker
More rework of Lex for "how tiny can she be..." |
75 |
|
76 |
/* The text in a CHANGE COLUMN clause in ALTER TABLE */
|
|
77 |
char *change; |
|
78 |
||
79 |
/* An item representing the DEFAULT clause in CREATE/ALTER TABLE */
|
|
80 |
Item *default_value; |
|
81 |
||
82 |
/* An item representing the ON UPDATE clause in CREATE/ALTER TABLE */
|
|
83 |
Item *on_update_value; |
|
84 |
||
85 |
enum column_format_type column_format; |
|
86 |
||
87 |
/* Poly-use */
|
|
2371.1.2
by Brian Aker
Remove the typedef on lexkey |
88 |
lex_string_t comment; |
1222.2.3
by Brian Aker
Remove a few more options, from options in HA_CREATE_INFO. |
89 |
|
2029.1.2
by Brian Aker
Merge in refactor of LIKE up to its own calling pointer in the parser. |
90 |
bool is_engine_set; |
1222.2.3
by Brian Aker
Remove a few more options, from options in HA_CREATE_INFO. |
91 |
bool is_create_table_like; |
2029.1.1
by Brian Aker
Merge in first pass. |
92 |
bool lex_identified_temp_table; |
93 |
bool link_to_local; |
|
94 |
TableList *create_table_list; |
|
1245.3.2
by Stewart Smith
small addition of custom engine options in parser and statement/create_table. No error checking performed yet (although the list is constructed). We are parsing them in () after ENGINE=FOO in CREATE TABLE and not as first class options to CREATE TABLE (like ENGINE=) currently due to shift/reduce conflicts in parser if we do. We must first reimpliment the existing CREATE TABLE options as these options before we can have this. |
95 |
|
1502.1.30
by Brian Aker
First pass on cleanup of Stewart's patch, plus re-engineer to make it work a |
96 |
bool validateCreateTableOption(); |
1100.3.65
by Padraig O'Sullivan
Extracted the CREATE TABLE command into its own class and implementation |
97 |
};
|
98 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
99 |
} /* namespace statement */ |
1100.3.65
by Padraig O'Sullivan
Extracted the CREATE TABLE command into its own class and implementation |
100 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
101 |
} /* namespace drizzled */ |
1100.3.65
by Padraig O'Sullivan
Extracted the CREATE TABLE command into its own class and implementation |
102 |