summaryrefslogtreecommitdiff
path: root/sql/sql_alter.h
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2018-02-16 10:56:03 +0200
committerMonty <monty@mariadb.org>2018-03-29 13:59:40 +0300
commit2dbeebdb16436e3c2723cd483aaf21d93de799d6 (patch)
tree541a3f79353cdbd7c3b7e32e8cfb57237cc24167 /sql/sql_alter.h
parent0631f20ff75269f2ce427200d8116bb2b6c75605 (diff)
downloadmariadb-git-2dbeebdb16436e3c2723cd483aaf21d93de799d6.tar.gz
Changed static const in Alter_info and Alter_online_info to defines
Main reason was to make it easier to print the above structures in a debugger. Additional benefits is that I was able to use same defines for both structures, which simplifes some code. Most of the code is just removing Alter_info:: and Alter_inplace_info:: from alter table flags. Following renames was done: HA_ALTER_FLAGS -> alter_table_operations CHANGE_CREATE_OPTION -> ALTER_CHANGE_CREATE_OPTION Alter_info::ADD_INDEX -> ALTER_ADD_INDEX DROP_INDEX -> ALTER_DROP_INDEX ADD_UNIQUE_INDEX -> ALTER_ADD_UNIQUE_INDEX DROP_UNIQUE_INDEx -> ALTER_DROP_UNIQUE_INDEX ADD_PK_INDEX -> ALTER_ADD_PK_INDEX DROP_PK_INDEX -> ALTER_DROP_PK_INDEX Alter_info:ALTER_ADD_COLUMN -> ALTER_PARSE_ADD_COLUMN Alter_info:ALTER_DROP_COLUMN -> ALTER_PARSE_DROP_COLUMN Alter_inplace_info::ADD_INDEX -> ALTER_ADD_NON_UNIQUE_NON_PRIM_INDEX Alter_inplace_info::DROP_INDEX -> ALTER_DROP_NON_UNIQUE_NON_PRIM_INDEX Other things: - Added typedef alter_table_operatons for alter table flags - DROP CHECK CONSTRAINT can now be done online - Added checks for Aria tables in alter_table_online.test - alter_table_flags now takes an ulonglong as argument. - Don't support online operations if checksum option is used. - sql_lex.cc doesn't add ALTER_ADD_INDEX if index is not created
Diffstat (limited to 'sql/sql_alter.h')
-rw-r--r--sql/sql_alter.h77
1 files changed, 3 insertions, 74 deletions
diff --git a/sql/sql_alter.h b/sql/sql_alter.h
index 4314d662d3d..3245e4b195c 100644
--- a/sql/sql_alter.h
+++ b/sql/sql_alter.h
@@ -29,85 +29,14 @@ class Key;
class Alter_info
{
public:
- /*
- These flags are set by the parser and describes the type of
- operation(s) specified by the ALTER TABLE statement.
-
- They do *not* describe the type operation(s) to be executed
- by the storage engine. For example, we don't yet know the
- type of index to be added/dropped.
- */
-
- /** Set for ADD [COLUMN] */
- static const ulonglong ALTER_ADD_COLUMN = 1ULL << 0;
- /** Set for DROP [COLUMN] */
- static const ulonglong ALTER_DROP_COLUMN = 1ULL << 1;
- /** Set for CHANGE [COLUMN] | MODIFY [CHANGE] & mysql_recreate_table */
- static const ulonglong ALTER_CHANGE_COLUMN = 1ULL << 2;
- /** Set for ADD INDEX | ADD KEY | ADD PRIMARY KEY | ADD UNIQUE KEY |
- ADD UNIQUE INDEX | ALTER ADD [COLUMN] */
- static const ulonglong ALTER_ADD_INDEX = 1ULL << 3;
- /** Set for DROP PRIMARY KEY | DROP FOREIGN KEY | DROP KEY | DROP INDEX */
- static const ulonglong ALTER_DROP_INDEX = 1ULL << 4;
- /** Set for RENAME [TO] */
- static const ulonglong ALTER_RENAME = 1ULL << 5;
- /** Set for ORDER BY */
- static const ulonglong ALTER_ORDER = 1ULL << 6;
- /** Set for table_options */
- static const ulonglong ALTER_OPTIONS = 1ULL << 7;
- /** Set for ALTER [COLUMN] ... SET DEFAULT ... | DROP DEFAULT */
- static const ulonglong ALTER_CHANGE_COLUMN_DEFAULT = 1ULL << 8;
- /** Set for DISABLE KEYS | ENABLE KEYS */
- static const ulonglong ALTER_KEYS_ONOFF = 1ULL << 9;
- /** Set for FORCE, ENGINE(same engine), by mysql_recreate_table() */
- static const ulonglong ALTER_RECREATE = 1ULL << 10;
- /** Set for ADD PARTITION */
- static const ulonglong ALTER_ADD_PARTITION = 1ULL << 11;
- /** Set for DROP PARTITION */
- static const ulonglong ALTER_DROP_PARTITION = 1ULL << 12;
- /** Set for COALESCE PARTITION */
- static const ulonglong ALTER_COALESCE_PARTITION = 1ULL << 13;
- /** Set for REORGANIZE PARTITION ... INTO */
- static const ulonglong ALTER_REORGANIZE_PARTITION = 1ULL << 14;
- /** Set for partition_options */
- static const ulonglong ALTER_PARTITION = 1ULL << 15;
- /** Set for LOAD INDEX INTO CACHE ... PARTITION
- and CACHE INDEX ... PARTITION */
- static const ulonglong ALTER_ADMIN_PARTITION = 1ULL << 16;
- /** Set for REORGANIZE PARTITION */
- static const ulonglong ALTER_TABLE_REORG = 1ULL << 17;
- /** Set for REBUILD PARTITION */
- static const ulonglong ALTER_REBUILD_PARTITION = 1ULL << 18;
- /** Set for partitioning operations specifying ALL keyword */
- static const ulonglong ALTER_ALL_PARTITION = 1ULL << 19;
- /** Set for REMOVE PARTITIONING */
- static const ulonglong ALTER_REMOVE_PARTITIONING = 1ULL << 20;
- /** Set for ADD FOREIGN KEY */
- static const ulonglong ADD_FOREIGN_KEY = 1ULL << 21;
- /** Set for DROP FOREIGN KEY */
- static const ulonglong DROP_FOREIGN_KEY = 1ULL << 22;
- /** Set for EXCHANGE PARITION */
- static const ulonglong ALTER_EXCHANGE_PARTITION = 1ULL << 23;
- /** Set by Sql_cmd_alter_table_truncate_partition::execute() */
- static const ulonglong ALTER_TRUNCATE_PARTITION = 1ULL << 24;
- /** Set for ADD [COLUMN] FIRST | AFTER */
- static const ulonglong ALTER_COLUMN_ORDER = 1ULL << 25;
- static const ulonglong ALTER_ADD_CHECK_CONSTRAINT = 1ULL << 27;
- static const ulonglong ALTER_DROP_CHECK_CONSTRAINT = 1ULL << 28;
- static const ulonglong ALTER_RENAME_COLUMN = 1ULL << 29;
- static const ulonglong ALTER_COLUMN_UNVERSIONED = 1ULL << 30;
- static const ulonglong ALTER_ADD_SYSTEM_VERSIONING = 1ULL << 31;
- static const ulonglong ALTER_DROP_SYSTEM_VERSIONING= 1ULL << 32;
- static const ulonglong ALTER_ADD_PERIOD = 1ULL << 33;
- static const ulonglong ALTER_DROP_PERIOD = 1ULL << 34;
enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
bool data_modifying() const
{
return flags & (
- ALTER_ADD_COLUMN |
- ALTER_DROP_COLUMN |
+ ALTER_PARSER_ADD_COLUMN |
+ ALTER_PARSER_DROP_COLUMN |
ALTER_CHANGE_COLUMN |
ALTER_COLUMN_ORDER);
}
@@ -176,7 +105,7 @@ public:
};
List<Virtual_column_info> check_constraint_list;
// Type of ALTER TABLE operation.
- ulonglong flags;
+ alter_table_operations flags;
// Enable or disable keys.
enum_enable_or_disable keys_onoff;
// List of partitions.