~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/alter_info.h

  • Committer: Jay Pipes
  • Date: 2009-09-15 21:01:42 UTC
  • mto: (1126.2.5 merge)
  • mto: This revision was merged to the branch mainline in revision 1128.
  • Revision ID: jpipes@serialcoder-20090915210142-x8mwiqn1q0vzjspp
Moves Alter_info out into its own header and source file, cleans up some related include mess in sql_lex.h, and renames Alter_info to AlterInfo.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2009 Sun Microsystems
 
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
 
 
21
/**
 
22
 * @file Declaration of the AlterInfo class
 
23
 */
 
24
 
 
25
#ifndef DRIZZLED_ALTER_INFO_H
 
26
#define DRIZZLED_ALTER_INFO_H
 
27
 
 
28
#include "drizzled/base.h"
 
29
#include "drizzled/enum.h"
 
30
#include "drizzled/sql_list.h" /** @TODO use STL vectors! */
 
31
 
 
32
#include <bitset>
 
33
 
 
34
/* Some forward declarations needed */
 
35
class CreateField;
 
36
class Alter_drop;
 
37
class Alter_column;
 
38
class Key;
 
39
 
 
40
enum enum_alter_info_flags
 
41
{
 
42
  ALTER_ADD_COLUMN= 0,
 
43
  ALTER_DROP_COLUMN,
 
44
  ALTER_CHANGE_COLUMN,
 
45
  ALTER_COLUMN_STORAGE,
 
46
  ALTER_COLUMN_FORMAT,
 
47
  ALTER_COLUMN_ORDER,
 
48
  ALTER_ADD_INDEX,
 
49
  ALTER_DROP_INDEX,
 
50
  ALTER_RENAME,
 
51
  ALTER_ORDER,
 
52
  ALTER_OPTIONS,
 
53
  ALTER_COLUMN_DEFAULT,
 
54
  ALTER_KEYS_ONOFF,
 
55
  ALTER_STORAGE,
 
56
  ALTER_ROW_FORMAT,
 
57
  ALTER_CONVERT,
 
58
  ALTER_FORCE,
 
59
  ALTER_RECREATE,
 
60
  ALTER_TABLE_REORG,
 
61
  ALTER_FOREIGN_KEY
 
62
};
 
63
 
 
64
enum tablespace_op_type
 
65
{
 
66
  NO_TABLESPACE_OP,
 
67
  DISCARD_TABLESPACE,
 
68
  IMPORT_TABLESPACE
 
69
};
 
70
 
 
71
/**
 
72
 * Contains information about the parsed CREATE or ALTER TABLE statement.
 
73
 *
 
74
 * This structure contains a list of columns or indexes to be created,
 
75
 * altered or dropped.
 
76
 */
 
77
class AlterInfo
 
78
{
 
79
public:
 
80
  List<Alter_drop> drop_list;
 
81
  List<Alter_column> alter_list;
 
82
  List<Key> key_list;
 
83
  List<CreateField> create_list;
 
84
  std::bitset<32> flags;
 
85
  enum enum_enable_or_disable keys_onoff;
 
86
  enum tablespace_op_type tablespace_op;
 
87
  uint32_t no_parts;
 
88
  enum ha_build_method build_method;
 
89
  CreateField *datetime_field;
 
90
  bool error_if_not_empty;
 
91
 
 
92
  AlterInfo();
 
93
  AlterInfo(const AlterInfo &rhs, MEM_ROOT *mem_root);
 
94
  void reset();
 
95
private:
 
96
  AlterInfo &operator=(const AlterInfo &rhs); // not implemented
 
97
  AlterInfo(const AlterInfo &rhs);            // not implemented
 
98
};
 
99
 
 
100
#endif /* DRIZZLED_ALTER_INFO_H */