22
22
* @file Implementation of the AlterInfo class
25
#include "drizzled/server_includes.h"
26
26
#include "drizzled/alter_info.h"
27
27
#include "drizzled/alter_drop.h"
28
28
#include "drizzled/alter_column.h"
29
29
#include "drizzled/key.h"
30
30
#include "drizzled/create_field.h"
35
32
AlterInfo::AlterInfo() :
37
34
keys_onoff(LEAVE_AS_IS),
38
35
tablespace_op(NO_TABLESPACE_OP),
40
37
build_method(HA_BUILD_DEFAULT),
41
39
error_if_not_empty(false)
44
} /* namespace drizzled */
42
void AlterInfo::reset()
49
keys_onoff= LEAVE_AS_IS;
50
tablespace_op= NO_TABLESPACE_OP;
52
build_method= HA_BUILD_DEFAULT;
54
error_if_not_empty= false;
58
Construct a copy of this object to be used for mysql_alter_table
59
and mysql_create_table.
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.
66
@return You need to use check the error in Session for out
67
of memory condition after calling this function.
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),
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)
83
Make deep copies of used objects.
84
This is not a fully deep copy - clone() implementations
85
of AlterDrop, AlterColumn, Key, foreign_key, Key_part_spec
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.
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);