1126.3.3
by Jay Pipes
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. |
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 Implementation of the AlterInfo class
|
|
23 |
*/
|
|
24 |
||
25 |
#include "drizzled/server_includes.h" |
|
26 |
#include "drizzled/alter_info.h" |
|
27 |
#include "drizzled/alter_drop.h" |
|
28 |
#include "drizzled/alter_column.h" |
|
29 |
#include "drizzled/key.h" |
|
30 |
#include "drizzled/create_field.h" |
|
31 |
||
32 |
AlterInfo::AlterInfo() : |
|
33 |
flags(), |
|
34 |
keys_onoff(LEAVE_AS_IS), |
|
35 |
tablespace_op(NO_TABLESPACE_OP), |
|
36 |
no_parts(0), |
|
37 |
build_method(HA_BUILD_DEFAULT), |
|
38 |
datetime_field(NULL), |
|
39 |
error_if_not_empty(false) |
|
40 |
{}
|
|
41 |
||
42 |
void AlterInfo::reset() |
|
43 |
{
|
|
44 |
drop_list.empty(); |
|
45 |
alter_list.empty(); |
|
46 |
key_list.empty(); |
|
47 |
create_list.empty(); |
|
48 |
flags.reset(); |
|
49 |
keys_onoff= LEAVE_AS_IS; |
|
50 |
tablespace_op= NO_TABLESPACE_OP; |
|
51 |
no_parts= 0; |
|
52 |
build_method= HA_BUILD_DEFAULT; |
|
53 |
datetime_field= 0; |
|
54 |
error_if_not_empty= false; |
|
55 |
}
|
|
56 |
||
57 |
/**
|
|
58 |
Construct a copy of this object to be used for mysql_alter_table
|
|
59 |
and mysql_create_table.
|
|
60 |
||
61 |
Historically, these two functions modify their AlterInfo
|
|
62 |
arguments. This behaviour breaks re-execution of prepared
|
|
63 |
statements and stored procedures and is compensated by always
|
|
64 |
supplying a copy of AlterInfo to these functions.
|
|
65 |
||
66 |
@return You need to use check the error in Session for out
|
|
67 |
of memory condition after calling this function.
|
|
68 |
*/
|
|
69 |
AlterInfo::AlterInfo(const AlterInfo &rhs, MEM_ROOT *mem_root) : |
|
70 |
drop_list(rhs.drop_list, mem_root), |
|
71 |
alter_list(rhs.alter_list, mem_root), |
|
72 |
key_list(rhs.key_list, mem_root), |
|
73 |
create_list(rhs.create_list, mem_root), |
|
74 |
flags(rhs.flags), |
|
75 |
keys_onoff(rhs.keys_onoff), |
|
76 |
tablespace_op(rhs.tablespace_op), |
|
77 |
no_parts(rhs.no_parts), |
|
78 |
build_method(rhs.build_method), |
|
79 |
datetime_field(rhs.datetime_field), |
|
80 |
error_if_not_empty(rhs.error_if_not_empty) |
|
81 |
{
|
|
82 |
/*
|
|
83 |
Make deep copies of used objects.
|
|
84 |
This is not a fully deep copy - clone() implementations
|
|
1126.3.4
by Jay Pipes
Changes Alter_drop and Alter_column to AlterDrop and AlterColumn. Next up: bye bye List<> in AlterInfo. |
85 |
of AlterDrop, AlterColumn, Key, foreign_key, Key_part_spec
|
1126.3.3
by Jay Pipes
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. |
86 |
do not copy string constants. At the same length the only
|
87 |
reason we make a copy currently is that ALTER/CREATE TABLE
|
|
88 |
code changes input AlterInfo definitions, but string
|
|
89 |
constants never change.
|
|
90 |
*/
|
|
91 |
list_copy_and_replace_each_value(drop_list, mem_root); |
|
92 |
list_copy_and_replace_each_value(alter_list, mem_root); |
|
93 |
list_copy_and_replace_each_value(key_list, mem_root); |
|
94 |
list_copy_and_replace_each_value(create_list, mem_root); |
|
95 |
}
|