1 /* Copyright (c) 2008, 2021, Oracle and/or its affiliates. 2 3 This program is free software; you can redistribute it and/or modify 4 it under the terms of the GNU General Public License, version 2.0, 5 as published by the Free Software Foundation. 6 7 This program is also distributed with certain software (including 8 but not limited to OpenSSL) that is licensed under separate terms, 9 as designated in a particular file or component or in included license 10 documentation. The authors of MySQL hereby grant you an additional 11 permission to link the program and your derivative works with the 12 separately licensed software that they have included with MySQL. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License, version 2.0, for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software Foundation, 21 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ 22 23 #ifndef PFS_COLUMN_TYPES_H 24 #define PFS_COLUMN_TYPES_H 25 26 /** 27 @file storage/perfschema/pfs_column_types.h 28 Data types for columns used in the performance schema tables (declarations) 29 */ 30 31 /** Size of the OBJECT_SCHEMA columns. */ 32 #define COL_OBJECT_SCHEMA_SIZE 64 33 34 /** 35 Size of the extended OBJECT_NAME columns. 36 'Extended' columns are used when the object name also represents 37 the name of a non SQL object, such as a file name. 38 Size in bytes of: 39 - performance_schema.events_waits_current (OBJECT_NAME) 40 - performance_schema.events_waits_history (OBJECT_NAME) 41 - performance_schema.events_waits_history_long (OBJECT_NAME) 42 */ 43 #define COL_OBJECT_NAME_EXTENDED_SIZE 512 44 45 /** Size of the OBJECT_NAME columns. */ 46 #define COL_OBJECT_NAME_SIZE 64 47 48 /** Size of the INDEX_NAME columns. */ 49 #define COL_INDEX_NAME_SIZE 64 50 51 /** 52 Size of INFO columns. 53 Size in bytes of: 54 - performance_schema.events_statement_current (INFO) 55 - performance_schema.events_statement_history (INFO) 56 - performance_schema.events_statement_history_long (INFO) 57 */ 58 #define COL_INFO_SIZE 1024 59 60 /** Size of the SOURCE columns. */ 61 #define COL_SOURCE_SIZE 64 62 63 /** Size of the DIGEST columns. */ 64 #define COL_DIGEST_SIZE 64 65 66 /** 67 Enum values for the TIMER_NAME columns. 68 This enum is found in the following tables: 69 - performance_schema.setup_timer (TIMER_NAME) 70 - performance_schema.performance_timer (TIMER_NAME) 71 */ 72 enum enum_timer_name 73 { 74 TIMER_NAME_CYCLE= 1, 75 TIMER_NAME_NANOSEC= 2, 76 TIMER_NAME_MICROSEC= 3, 77 TIMER_NAME_MILLISEC= 4, 78 TIMER_NAME_TICK= 5 79 }; 80 81 /** Integer, first value of @sa enum_timer_name. */ 82 #define FIRST_TIMER_NAME (static_cast<int> (TIMER_NAME_CYCLE)) 83 /** Integer, last value of @sa enum_timer_name. */ 84 #define LAST_TIMER_NAME (static_cast<int> (TIMER_NAME_TICK)) 85 /** Integer, number of values of @sa enum_timer_name. */ 86 #define COUNT_TIMER_NAME (LAST_TIMER_NAME - FIRST_TIMER_NAME + 1) 87 88 /** 89 Enum values for the various YES/NO columns. 90 This enum is found in the following tables: 91 - performance_schema.setup_instruments (ENABLED) 92 - performance_schema.setup_instruments (TIMED) 93 - performance_schema.setup_consumers (ENABLED) 94 */ 95 enum enum_yes_no 96 { 97 ENUM_YES= 1, 98 ENUM_NO= 2 99 }; 100 101 /** 102 Enum values for the various OPERATION columns. 103 This enum is found in the following tables: 104 - performance_schema.events_waits_current (OPERATION) 105 - performance_schema.events_waits_history (OPERATION) 106 - performance_schema.events_waits_history_long (OPERATION) 107 */ 108 enum enum_operation_type 109 { 110 /* Mutex operations */ 111 OPERATION_TYPE_LOCK= 1, 112 OPERATION_TYPE_TRYLOCK= 2, 113 114 /* Rwlock operations (RW-lock) */ 115 OPERATION_TYPE_READLOCK= 3, 116 OPERATION_TYPE_WRITELOCK= 4, 117 OPERATION_TYPE_TRYREADLOCK= 5, 118 OPERATION_TYPE_TRYWRITELOCK= 6, 119 120 /* Rwlock operations (SX-lock) */ 121 OPERATION_TYPE_SHAREDLOCK= 7, 122 OPERATION_TYPE_SHAREDEXCLUSIVELOCK= 8, 123 OPERATION_TYPE_EXCLUSIVELOCK= 9, 124 OPERATION_TYPE_TRYSHAREDLOCK= 10, 125 OPERATION_TYPE_TRYSHAREDEXCLUSIVELOCK= 11, 126 OPERATION_TYPE_TRYEXCLUSIVELOCK= 12, 127 128 /* Cond operations */ 129 OPERATION_TYPE_WAIT= 13, 130 OPERATION_TYPE_TIMEDWAIT= 14, 131 132 /* File operations */ 133 OPERATION_TYPE_FILECREATE= 15, 134 OPERATION_TYPE_FILECREATETMP= 16, 135 OPERATION_TYPE_FILEOPEN= 17, 136 OPERATION_TYPE_FILESTREAMOPEN= 18, 137 OPERATION_TYPE_FILECLOSE= 19, 138 OPERATION_TYPE_FILESTREAMCLOSE= 20, 139 OPERATION_TYPE_FILEREAD= 21, 140 OPERATION_TYPE_FILEWRITE= 22, 141 OPERATION_TYPE_FILESEEK= 23, 142 OPERATION_TYPE_FILETELL= 24, 143 OPERATION_TYPE_FILEFLUSH= 25, 144 OPERATION_TYPE_FILESTAT= 26, 145 OPERATION_TYPE_FILEFSTAT= 27, 146 OPERATION_TYPE_FILECHSIZE= 28, 147 OPERATION_TYPE_FILEDELETE= 29, 148 OPERATION_TYPE_FILERENAME= 30, 149 OPERATION_TYPE_FILESYNC= 31, 150 151 /* Table io operations */ 152 OPERATION_TYPE_TABLE_FETCH= 32, 153 OPERATION_TYPE_TABLE_WRITE_ROW= 33, 154 OPERATION_TYPE_TABLE_UPDATE_ROW= 34, 155 OPERATION_TYPE_TABLE_DELETE_ROW= 35, 156 157 /* Table lock operations */ 158 OPERATION_TYPE_TL_READ_NORMAL= 36, 159 OPERATION_TYPE_TL_READ_WITH_SHARED_LOCKS= 37, 160 OPERATION_TYPE_TL_READ_HIGH_PRIORITY= 38, 161 OPERATION_TYPE_TL_READ_NO_INSERTS= 39, 162 OPERATION_TYPE_TL_WRITE_ALLOW_WRITE= 40, 163 OPERATION_TYPE_TL_WRITE_CONCURRENT_INSERT= 41, 164 OPERATION_TYPE_TL_WRITE_LOW_PRIORITY= 42, 165 OPERATION_TYPE_TL_WRITE_NORMAL= 43, 166 OPERATION_TYPE_TL_READ_EXTERNAL= 44, 167 OPERATION_TYPE_TL_WRITE_EXTERNAL= 45, 168 169 /* Socket operations */ 170 OPERATION_TYPE_SOCKETCREATE = 46, 171 OPERATION_TYPE_SOCKETCONNECT = 47, 172 OPERATION_TYPE_SOCKETBIND = 48, 173 OPERATION_TYPE_SOCKETCLOSE = 49, 174 OPERATION_TYPE_SOCKETSEND = 50, 175 OPERATION_TYPE_SOCKETRECV = 51, 176 OPERATION_TYPE_SOCKETSENDTO = 52, 177 OPERATION_TYPE_SOCKETRECVFROM = 53, 178 OPERATION_TYPE_SOCKETSENDMSG = 54, 179 OPERATION_TYPE_SOCKETRECVMSG = 55, 180 OPERATION_TYPE_SOCKETSEEK = 56, 181 OPERATION_TYPE_SOCKETOPT = 57, 182 OPERATION_TYPE_SOCKETSTAT = 58, 183 OPERATION_TYPE_SOCKETSHUTDOWN = 59, 184 OPERATION_TYPE_SOCKETSELECT = 60, 185 186 /* Idle operation */ 187 OPERATION_TYPE_IDLE= 61, 188 189 /* Metadata lock operation */ 190 OPERATION_TYPE_METADATA= 62 191 }; 192 /** Integer, first value of @sa enum_operation_type. */ 193 #define FIRST_OPERATION_TYPE (static_cast<int> (OPERATION_TYPE_LOCK)) 194 /** Integer, last value of @sa enum_operation_type. */ 195 #define LAST_OPERATION_TYPE (static_cast<int> (OPERATION_TYPE_METADATA)) 196 /** Integer, number of values of @sa enum_operation_type. */ 197 #define COUNT_OPERATION_TYPE (LAST_OPERATION_TYPE - FIRST_OPERATION_TYPE + 1) 198 199 /** 200 Enum values for the various OBJECT_TYPE columns. 201 */ 202 enum enum_object_type 203 { 204 NO_OBJECT_TYPE= 0, 205 206 /* Advertised in SQL ENUM */ 207 208 OBJECT_TYPE_EVENT= 1, 209 OBJECT_TYPE_FUNCTION= 2, 210 OBJECT_TYPE_PROCEDURE= 3, 211 OBJECT_TYPE_TABLE= 4, 212 OBJECT_TYPE_TRIGGER= 5, 213 214 /* Not advertised in SQL ENUM, only displayed as VARCHAR */ 215 216 OBJECT_TYPE_TEMPORARY_TABLE= 6, 217 OBJECT_TYPE_GLOBAL= 7, 218 OBJECT_TYPE_SCHEMA= 8, 219 OBJECT_TYPE_COMMIT= 9, 220 OBJECT_TYPE_USER_LEVEL_LOCK= 10, 221 OBJECT_TYPE_TABLESPACE= 11, 222 OBJECT_TYPE_LOCKING_SERVICE= 12, 223 OBJECT_TYPE_BACKUP= 13, 224 OBJECT_TYPE_BINLOG= 14 225 }; 226 /** Integer, first value of @sa enum_object_type. */ 227 #define FIRST_OBJECT_TYPE (static_cast<int> (OBJECT_TYPE_EVENT)) 228 /** Integer, last value of @sa enum_object_type. */ 229 #define LAST_OBJECT_TYPE (static_cast<int> (OBJECT_TYPE_LOCKING_SERVICE)) 230 /** Integer, number of values of @sa enum_object_type. */ 231 #define COUNT_OBJECT_TYPE (LAST_OBJECT_TYPE - FIRST_OBJECT_TYPE + 1) 232 233 /** 234 Enum values for the NESTING_EVENT_TYPE columns. 235 This enum is found in the following tables: 236 - performance_schema.events_waits_current (NESTING_EVENT_TYPE) 237 - performance_schema.events_stages_current (NESTING_EVENT_TYPE) 238 - performance_schema.events_statements_current (NESTING_EVENT_TYPE) 239 */ 240 enum enum_event_type 241 { 242 EVENT_TYPE_TRANSACTION= 1, 243 EVENT_TYPE_STATEMENT= 2, 244 EVENT_TYPE_STAGE= 3, 245 EVENT_TYPE_WAIT= 4 246 }; 247 248 /** Integer, first value of @sa enum_event_type. */ 249 #define FIRST_EVENT_TYPE (static_cast<int> (EVENT_TYPE_TRANSACTION)) 250 /** Integer, last value of @sa enum_event_type. */ 251 #define LAST_EVENT_TYPE (static_cast<int> (EVENT_TYPE_WAIT)) 252 /** Integer, number of values of @sa enum_event_type. */ 253 #define COUNT_EVENT_TYPE (LAST_EVENT_TYPE - FIRST_EVENT_TYPE + 1) 254 255 /** 256 Enum values for transaction state columns. 257 */ 258 enum enum_transaction_state 259 { 260 TRANS_STATE_ACTIVE= 1, 261 TRANS_STATE_COMMITTED= 2, 262 TRANS_STATE_ROLLED_BACK= 3 263 }; 264 265 /** Integer, first value of @sa enum_transaction_state. */ 266 #define FIRST_TRANS_STATE (static_cast<int> (TRANS_STATE_ACTIVE)) 267 /** Integer, last value of @sa enum_transaction_state. */ 268 #define LAST_TRANS_STATE (static_cast<int> (TRANS_STATE_ROLLED_BACK)) 269 /** Integer, number of values of @sa enum_transaction_state. */ 270 #define COUNT_TRANS_STATE (LAST_TRANS_STATE - FIRST_TRANS_STATE + 1) 271 272 /** 273 Enum values for XA transaction state columns. Enums 1-5 match those used by 274 the server. See XID_STATE::enum xa_states in xa.h. 275 */ 276 enum enum_xa_transaction_state 277 { 278 TRANS_STATE_XA_NOTR, 279 TRANS_STATE_XA_ACTIVE, 280 TRANS_STATE_XA_IDLE, 281 TRANS_STATE_XA_PREPARED, 282 TRANS_STATE_XA_ROLLBACK_ONLY, 283 TRANS_STATE_XA_COMMITTED 284 }; 285 286 /** Integer, first value of @sa enum_xa_transaction_state. */ 287 #define FIRST_TRANS_STATE_XA (static_cast<int> (TRANS_STATE_XA_NOTR)) 288 /** Integer, last value of @sa enum_xa_transaction_state. */ 289 #define LAST_TRANS_STATE_XA (static_cast<int> (TRANS_STATE_XA_COMMITTED)) 290 /** Integer, number of values of @sa enum_xa_transaction_state. */ 291 #define COUNT_TRANS_STATE_XA (LAST_TRANS_STATE_XA - FIRST_TRANS_STATE_XA + 1) 292 293 /** 294 Enum values for transaction isolation level columns. 295 See enum_tx_isolation in handler.h. 296 */ 297 enum enum_isolation_level 298 { 299 TRANS_LEVEL_READ_UNCOMMITTED, 300 TRANS_LEVEL_READ_COMMITTED, 301 TRANS_LEVEL_REPEATABLE_READ, 302 TRANS_LEVEL_SERIALIZABLE 303 }; 304 305 /** Integer, first value of @sa enum_isolation_level. */ 306 #define FIRST_TRANS_LEVEL (static_cast<int> (TRANS_LEVEL_READ_UNCOMMITTED)) 307 /** Integer, last value of @sa enum_isolation_level. */ 308 #define LAST_TRANS_LEVEL (static_cast<int> (TRANS_LEVEL_SERIALIZABLE)) 309 /** Integer, number of values of @sa enum_isolation_level. */ 310 #define COUNT_TRANS_LEVEL (LAST_TRANS_LEVEL - FIRST_TRANS_LEVEL + 1) 311 312 /** 313 Enum values for transaction acces mode columns. 314 */ 315 enum enum_transaction_mode 316 { 317 TRANS_MODE_READ_ONLY= 1, 318 TRANS_MODE_READ_WRITE= 2 319 }; 320 321 /** Integer, first value of @sa enum_transaction_mode. */ 322 #define FIRST_TRANS_MODE (static_cast<int> (TRANS_MODE_READ_WRITE)) 323 /** Integer, last value of @sa enum_transaction_mode. */ 324 #define LAST_TRANS_MODE (static_cast<int> (TRANS_MODE_READ_ONLY)) 325 /** Integer, number of values of @sa enum_transaction_mode. */ 326 #define COUNT_TRANS_MODE (LAST_TRANS_MODE - FIRST_TRANS_MODE + 1) 327 328 329 #endif 330 331