Commit d82ac8ea authored by Michael Widenius's avatar Michael Widenius Committed by Monty

Change "static int" to enum in classes

This was done when static int where used as bit fields or enums
parent 00946f43
...@@ -1483,13 +1483,15 @@ struct THD_TRANS ...@@ -1483,13 +1483,15 @@ struct THD_TRANS
unsigned int m_unsafe_rollback_flags; unsigned int m_unsafe_rollback_flags;
/* /*
Define the type of statemens which cannot be rolled back safely. Define the type of statements which cannot be rolled back safely.
Each type occupies one bit in m_unsafe_rollback_flags. Each type occupies one bit in m_unsafe_rollback_flags.
*/ */
static unsigned int const MODIFIED_NON_TRANS_TABLE= 0x01; enum unsafe_statement_types
static unsigned int const CREATED_TEMP_TABLE= 0x02; {
static unsigned int const DROPPED_TEMP_TABLE= 0x04; CREATED_TEMP_TABLE= 2,
static unsigned int const DID_WAIT= 0x08; DROPPED_TEMP_TABLE= 4,
DID_WAIT= 8
};
void mark_created_temp_table() void mark_created_temp_table()
{ {
......
...@@ -1153,7 +1153,7 @@ class Item_sum_bit :public Item_sum_int ...@@ -1153,7 +1153,7 @@ class Item_sum_bit :public Item_sum_int
} }
protected: protected:
static const int NUM_BIT_COUNTERS= 64; enum bit_counters { NUM_BIT_COUNTERS= 64 };
ulonglong reset_bits,bits; ulonglong reset_bits,bits;
/* /*
Marks whether the function is to be computed as a window function. Marks whether the function is to be computed as a window function.
......
...@@ -3459,7 +3459,7 @@ class Gtid_log_event: public Log_event ...@@ -3459,7 +3459,7 @@ class Gtid_log_event: public Log_event
The three elements in the body repeat COUNT times to form the GTID list. The three elements in the body repeat COUNT times to form the GTID list.
At the time of writing, only one flag bit is in use. At the time of writing, only two flag bit are in use.
Bit 28 of `count' is used for flag FLAG_UNTIL_REACHED, which is sent in a Bit 28 of `count' is used for flag FLAG_UNTIL_REACHED, which is sent in a
Gtid_list event from the master to the slave to indicate that the START Gtid_list event from the master to the slave to indicate that the START
...@@ -3477,9 +3477,12 @@ class Gtid_list_log_event: public Log_event ...@@ -3477,9 +3477,12 @@ class Gtid_list_log_event: public Log_event
uint64 *sub_id_list; uint64 *sub_id_list;
static const uint element_size= 4+4+8; static const uint element_size= 4+4+8;
static const uint32 FLAG_UNTIL_REACHED= (1<<28); /* Upper bits stored in 'count'. See comment above */
static const uint32 FLAG_IGN_GTIDS= (1<<29); enum gtid_flags
{
FLAG_UNTIL_REACHED= (1<<28),
FLAG_IGN_GTIDS= (1<<29),
};
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
Gtid_list_log_event(rpl_binlog_state *gtid_set, uint32 gl_flags); Gtid_list_log_event(rpl_binlog_state *gtid_set, uint32 gl_flags);
Gtid_list_log_event(slave_connection_state *gtid_set, uint32 gl_flags); Gtid_list_log_event(slave_connection_state *gtid_set, uint32 gl_flags);
......
...@@ -270,8 +270,12 @@ struct slave_connection_state ...@@ -270,8 +270,12 @@ struct slave_connection_state
rpl_gtid gtid; rpl_gtid gtid;
uint32 flags; uint32 flags;
}; };
static const uint32 START_OWN_SLAVE_POS= 0x1; /* Bits for 'flags' */
static const uint32 START_ON_EMPTY_DOMAIN= 0x2; enum start_flags
{
START_OWN_SLAVE_POS= 0x1,
START_ON_EMPTY_DOMAIN= 0x2
};
/* Mapping from domain_id to the entry with GTID requested for that domain. */ /* Mapping from domain_id to the entry with GTID requested for that domain. */
HASH hash; HASH hash;
......
...@@ -68,23 +68,27 @@ struct group_commit_orderer { ...@@ -68,23 +68,27 @@ struct group_commit_orderer {
*/ */
bool installed; bool installed;
/* enum force_switch_bits
This flag is set for a GCO in which we have event groups with multiple {
different commit_id values from the master. This happens when we /*
optimistically try to execute in parallel transactions not known to be This flag is set for a GCO in which we have event groups with multiple
conflict-free. different commit_id values from the master. This happens when we
optimistically try to execute in parallel transactions not known to be
When this flag is set, in case of DDL we need to start a new GCO regardless conflict-free.
of current commit_id, as DDL is not safe to speculatively apply in parallel
with prior event groups. When this flag is set, in case of DDL we need to start a new GCO
*/ regardless of current commit_id, as DDL is not safe to
static const uint8 MULTI_BATCH = 0x01; speculatively apply in parallel with prior event groups.
/* */
This flag is set for a GCO that contains DDL. If set, it forces a switch to MULTI_BATCH= 1,
a new GCO upon seeing a new commit_id, as DDL is not safe to speculatively /*
replicate in parallel with subsequent transactions. This flag is set for a GCO that contains DDL. If set, it forces
*/ a switch to a new GCO upon seeing a new commit_id, as DDL is not
static const uint8 FORCE_SWITCH = 0x02; safe to speculatively replicate in parallel with subsequent
transactions.
*/
FORCE_SWITCH= 2
};
uint8 flags; uint8 flags;
}; };
......
...@@ -38,91 +38,65 @@ class Alter_info ...@@ -38,91 +38,65 @@ class Alter_info
type of index to be added/dropped. type of index to be added/dropped.
*/ */
// Set for ADD [COLUMN] enum operations_used_flags
static const uint ALTER_ADD_COLUMN = 1L << 0; {
// Set for ADD [COLUMN]
// Set for DROP [COLUMN] ALTER_ADD_COLUMN = 1L << 0,
static const uint ALTER_DROP_COLUMN = 1L << 1; // Set for DROP [COLUMN]
ALTER_DROP_COLUMN = 1L << 1,
// Set for CHANGE [COLUMN] | MODIFY [CHANGE] // Set for CHANGE [COLUMN] | MODIFY [CHANGE] & mysql_recreate_table
// Set by mysql_recreate_table() ALTER_CHANGE_COLUMN = 1L << 2,
static const uint ALTER_CHANGE_COLUMN = 1L << 2; // Set for ADD INDEX | ADD KEY | ADD PRIMARY KEY | ADD UNIQUE KEY |
// ADD UNIQUE INDEX | ALTER ADD [COLUMN]
// Set for ADD INDEX | ADD KEY | ADD PRIMARY KEY | ADD UNIQUE KEY | ALTER_ADD_INDEX = 1L << 3,
// ADD UNIQUE INDEX | ALTER ADD [COLUMN] // Set for DROP PRIMARY KEY | DROP FOREIGN KEY | DROP KEY | DROP INDEX
static const uint ALTER_ADD_INDEX = 1L << 3; ALTER_DROP_INDEX = 1L << 4,
// Set for RENAME [TO]
// Set for DROP PRIMARY KEY | DROP FOREIGN KEY | DROP KEY | DROP INDEX ALTER_RENAME = 1L << 5,
static const uint ALTER_DROP_INDEX = 1L << 4; // Set for ORDER BY
ALTER_ORDER = 1L << 6,
// Set for RENAME [TO] // Set for table_options
static const uint ALTER_RENAME = 1L << 5; ALTER_OPTIONS = 1L << 7,
// Set for ALTER [COLUMN] ... SET DEFAULT ... | DROP DEFAULT
// Set for ORDER BY ALTER_CHANGE_COLUMN_DEFAULT = 1L << 8,
static const uint ALTER_ORDER = 1L << 6; // Set for DISABLE KEYS | ENABLE KEYS
ALTER_KEYS_ONOFF = 1L << 9,
// Set for table_options // Set for FORCE, ENGINE(same engine), by mysql_recreate_table()
static const uint ALTER_OPTIONS = 1L << 7; ALTER_RECREATE = 1L << 10,
// Set for ADD PARTITION
// Set for ALTER [COLUMN] ... SET DEFAULT ... | DROP DEFAULT ALTER_ADD_PARTITION = 1L << 11,
static const uint ALTER_CHANGE_COLUMN_DEFAULT = 1L << 8; // Set for DROP PARTITION
ALTER_DROP_PARTITION = 1L << 12,
// Set for DISABLE KEYS | ENABLE KEYS // Set for COALESCE PARTITION
static const uint ALTER_KEYS_ONOFF = 1L << 9; ALTER_COALESCE_PARTITION = 1L << 13,
// Set for REORGANIZE PARTITION ... INTO
// Set for FORCE ALTER_REORGANIZE_PARTITION = 1L << 14,
// Set for ENGINE(same engine) // Set for partition_options
// Set by mysql_recreate_table() ALTER_PARTITION = 1L << 15,
static const uint ALTER_RECREATE = 1L << 10; // Set for LOAD INDEX INTO CACHE ... PARTITION
// Set for CACHE INDEX ... PARTITION
// Set for ADD PARTITION ALTER_ADMIN_PARTITION = 1L << 16,
static const uint ALTER_ADD_PARTITION = 1L << 11; // Set for REORGANIZE PARTITION
ALTER_TABLE_REORG = 1L << 17,
// Set for DROP PARTITION // Set for REBUILD PARTITION
static const uint ALTER_DROP_PARTITION = 1L << 12; ALTER_REBUILD_PARTITION = 1L << 18,
// Set for partitioning operations specifying ALL keyword
// Set for COALESCE PARTITION ALTER_ALL_PARTITION = 1L << 19,
static const uint ALTER_COALESCE_PARTITION = 1L << 13; // Set for REMOVE PARTITIONING
ALTER_REMOVE_PARTITIONING = 1L << 20,
// Set for REORGANIZE PARTITION ... INTO // Set for ADD FOREIGN KEY
static const uint ALTER_REORGANIZE_PARTITION = 1L << 14; ADD_FOREIGN_KEY = 1L << 21,
// Set for DROP FOREIGN KEY
// Set for partition_options DROP_FOREIGN_KEY = 1L << 22,
static const uint ALTER_PARTITION = 1L << 15; // Set for EXCHANGE PARITION
ALTER_EXCHANGE_PARTITION = 1L << 23,
// Set for LOAD INDEX INTO CACHE ... PARTITION // Set by Sql_cmd_alter_table_truncate_partition::execute()
// Set for CACHE INDEX ... PARTITION ALTER_TRUNCATE_PARTITION = 1L << 24,
static const uint ALTER_ADMIN_PARTITION = 1L << 16; // Set for ADD [COLUMN] FIRST | AFTER
ALTER_COLUMN_ORDER = 1L << 25,
// Set for REORGANIZE PARTITION ALTER_ADD_CHECK_CONSTRAINT = 1L << 27,
static const uint ALTER_TABLE_REORG = 1L << 17; ALTER_DROP_CHECK_CONSTRAINT = 1L << 28
};
// Set for REBUILD PARTITION
static const uint ALTER_REBUILD_PARTITION = 1L << 18;
// Set for partitioning operations specifying ALL keyword
static const uint ALTER_ALL_PARTITION = 1L << 19;
// Set for REMOVE PARTITIONING
static const uint ALTER_REMOVE_PARTITIONING = 1L << 20;
// Set for ADD FOREIGN KEY
static const uint ADD_FOREIGN_KEY = 1L << 21;
// Set for DROP FOREIGN KEY
static const uint DROP_FOREIGN_KEY = 1L << 22;
// Set for EXCHANGE PARITION
static const uint ALTER_EXCHANGE_PARTITION = 1L << 23;
// Set by Sql_cmd_alter_table_truncate_partition::execute()
static const uint ALTER_TRUNCATE_PARTITION = 1L << 24;
// Set for ADD [COLUMN] FIRST | AFTER
static const uint ALTER_COLUMN_ORDER = 1L << 25;
static const uint ALTER_ADD_CHECK_CONSTRAINT = 1L << 27;
static const uint ALTER_DROP_CHECK_CONSTRAINT = 1L << 28;
enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE }; enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
...@@ -172,7 +146,10 @@ class Alter_info ...@@ -172,7 +146,10 @@ class Alter_info
// List of columns, used by both CREATE and ALTER TABLE. // List of columns, used by both CREATE and ALTER TABLE.
List<Create_field> create_list; List<Create_field> create_list;
static const uint CHECK_CONSTRAINT_IF_NOT_EXISTS= 1; enum flags_bits
{
CHECK_CONSTRAINT_IF_NOT_EXISTS= 1
};
List<Virtual_column_info> check_constraint_list; List<Virtual_column_info> check_constraint_list;
// Type of ALTER TABLE operation. // Type of ALTER TABLE operation.
uint flags; uint flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment