24 #include <my_global.h>
39 #define HA_OPEN_ABORT_IF_LOCKED 0
40 #define HA_OPEN_WAIT_IF_LOCKED 1
41 #define HA_OPEN_IGNORE_IF_LOCKED 2
42 #define HA_OPEN_TMP_TABLE 4
43 #define HA_OPEN_DELAY_KEY_WRITE 8
44 #define HA_OPEN_ABORT_IF_CRASHED 16
45 #define HA_OPEN_FOR_REPAIR 32
46 #define HA_OPEN_FROM_SQL_LAYER 64
47 #define HA_OPEN_MMAP 128
48 #define HA_OPEN_COPY 256
50 #define HA_OPEN_INTERNAL_TABLE 512
55 #define HA_OPEN_NO_PSI_CALL 1024
78 enum ha_rkey_function {
86 HA_READ_PREFIX_LAST_OR_PREV,
88 HA_READ_MBR_INTERSECT,
101 HA_KEY_ALG_FULLTEXT= 4
106 enum ha_storage_media {
114 enum ha_extra_function {
120 HA_EXTRA_NO_READCHECK=5,
121 HA_EXTRA_READCHECK=6,
123 HA_EXTRA_NO_KEYREAD=8,
124 HA_EXTRA_NO_USER_CHANGE=9,
125 HA_EXTRA_KEY_CACHE=10,
126 HA_EXTRA_NO_KEY_CACHE=11,
127 HA_EXTRA_WAIT_LOCK=12,
128 HA_EXTRA_NO_WAIT_LOCK=13,
129 HA_EXTRA_WRITE_CACHE=14,
130 HA_EXTRA_FLUSH_CACHE=15,
132 HA_EXTRA_KEYREAD_CHANGE_POS=17,
134 HA_EXTRA_REMEMBER_POS=18,
135 HA_EXTRA_RESTORE_POS=19,
136 HA_EXTRA_REINIT_CACHE=20,
137 HA_EXTRA_FORCE_REOPEN=21,
140 HA_EXTRA_RESET_STATE,
141 HA_EXTRA_IGNORE_DUP_KEY,
142 HA_EXTRA_NO_IGNORE_DUP_KEY,
143 HA_EXTRA_PREPARE_FOR_DROP,
144 HA_EXTRA_PREPARE_FOR_UPDATE,
145 HA_EXTRA_PRELOAD_BUFFER_SIZE,
149 HA_EXTRA_CHANGE_KEY_TO_UNIQUE,
150 HA_EXTRA_CHANGE_KEY_TO_DUP,
156 HA_EXTRA_KEYREAD_PRESERVE_FIELDS,
165 HA_EXTRA_IGNORE_NO_KEY,
166 HA_EXTRA_NO_IGNORE_NO_KEY,
171 HA_EXTRA_MARK_AS_LOG_TABLE,
179 HA_EXTRA_WRITE_CAN_REPLACE,
180 HA_EXTRA_WRITE_CANNOT_REPLACE,
187 HA_EXTRA_DELETE_CANNOT_BATCH,
188 HA_EXTRA_UPDATE_CANNOT_BATCH,
193 HA_EXTRA_INSERT_WITH_UPDATE,
195 HA_EXTRA_PREPARE_FOR_RENAME,
199 HA_EXTRA_ADD_CHILDREN_LIST,
200 HA_EXTRA_ATTACH_CHILDREN,
201 HA_EXTRA_IS_ATTACHED_CHILDREN,
202 HA_EXTRA_DETACH_CHILDREN,
211 #define HA_EXTRA_PREPARE_FOR_DELETE HA_EXTRA_PREPARE_FOR_DROP
215 enum ha_panic_function {
223 enum ha_base_keytype {
227 HA_KEYTYPE_SHORT_INT=3,
228 HA_KEYTYPE_LONG_INT=4,
232 HA_KEYTYPE_USHORT_INT=8,
233 HA_KEYTYPE_ULONG_INT=9,
234 HA_KEYTYPE_LONGLONG=10,
235 HA_KEYTYPE_ULONGLONG=11,
237 HA_KEYTYPE_UINT24=13,
240 HA_KEYTYPE_VARTEXT1=15,
241 HA_KEYTYPE_VARBINARY1=16,
243 HA_KEYTYPE_VARTEXT2=17,
244 HA_KEYTYPE_VARBINARY2=18,
248 #define HA_MAX_KEYTYPE 31
253 #define HA_PACK_KEY 2
254 #define HA_AUTO_KEY 16
255 #define HA_BINARY_PACK_KEY 32
256 #define HA_FULLTEXT 128
257 #define HA_UNIQUE_CHECK 256
258 #define HA_SPATIAL 1024
259 #define HA_NULL_ARE_EQUAL 2048
260 #define HA_GENERATED_KEY 8192
263 #define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \
264 HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \
265 HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY)
277 #define HA_KEY_HAS_PART_KEY_SEG 65536
281 #define HA_SPACE_PACK_USED 4
282 #define HA_VAR_LENGTH_KEY 8
283 #define HA_NULL_PART_KEY 64
284 #define HA_USES_COMMENT 4096
285 #define HA_USES_PARSER 16384
286 #define HA_USES_BLOCK_SIZE ((uint) 32768)
287 #define HA_SORT_ALLOWS_SAME 512
291 #define HA_SPACE_PACK 1
292 #define HA_PART_KEY_SEG 4
293 #define HA_VAR_LENGTH_PART 8
294 #define HA_NULL_PART 16
295 #define HA_BLOB_PART 32
296 #define HA_SWAP_KEY 64
297 #define HA_REVERSE_SORT 128
298 #define HA_NO_SORT 256
303 #define HA_END_SPACE_ARE_EQUAL 512
304 #define HA_BIT_PART 1024
307 #define HA_OPTION_PACK_RECORD 1
308 #define HA_OPTION_PACK_KEYS 2
309 #define HA_OPTION_COMPRESS_RECORD 4
310 #define HA_OPTION_LONG_BLOB_PTR 8
311 #define HA_OPTION_TMP_TABLE 16
312 #define HA_OPTION_CHECKSUM 32
313 #define HA_OPTION_DELAY_KEY_WRITE 64
314 #define HA_OPTION_NO_PACK_KEYS 128
315 #define HA_OPTION_CREATE_FROM_ENGINE 256
316 #define HA_OPTION_RELIES_ON_SQL_LAYER 512
317 #define HA_OPTION_NULL_FIELDS 1024
318 #define HA_OPTION_PAGE_CHECKSUM 2048
323 #define HA_OPTION_STATS_PERSISTENT 4096
330 #define HA_OPTION_NO_STATS_PERSISTENT 8192
331 #define HA_OPTION_TEMP_COMPRESS_RECORD ((uint) 16384)
332 #define HA_OPTION_READ_ONLY_DATA ((uint) 32768)
336 #define HA_DONT_TOUCH_DATA 1
337 #define HA_PACK_RECORD 2
338 #define HA_CREATE_TMP_TABLE 4
339 #define HA_CREATE_CHECKSUM 8
340 #define HA_CREATE_KEEP_FILES 16
341 #define HA_CREATE_PAGE_CHECKSUM 32
342 #define HA_CREATE_DELAY_KEY_WRITE 64
343 #define HA_CREATE_RELIES_ON_SQL_LAYER 128
344 #define HA_CREATE_INTERNAL_TABLE 256
355 #define HA_STATUS_POS 1
362 #define HA_STATUS_NO_LOCK 2
364 #define HA_STATUS_TIME 4
371 #define HA_STATUS_CONST 8
377 #define HA_STATUS_VARIABLE 16
383 #define HA_STATUS_ERRKEY 32
387 #define HA_STATUS_AUTO 64
392 #define HA_STATUS_VARIABLE_EXTRA 128
401 #define HA_ERR_FIRST 120
403 #define HA_ERR_KEY_NOT_FOUND 120
404 #define HA_ERR_FOUND_DUPP_KEY 121
405 #define HA_ERR_INTERNAL_ERROR 122
406 #define HA_ERR_RECORD_CHANGED 123
407 #define HA_ERR_WRONG_INDEX 124
408 #define HA_ERR_CRASHED 126
409 #define HA_ERR_WRONG_IN_RECORD 127
410 #define HA_ERR_OUT_OF_MEM 128
411 #define HA_ERR_NOT_A_TABLE 130
412 #define HA_ERR_WRONG_COMMAND 131
413 #define HA_ERR_OLD_FILE 132
414 #define HA_ERR_NO_ACTIVE_RECORD 133
415 #define HA_ERR_RECORD_DELETED 134
416 #define HA_ERR_RECORD_FILE_FULL 135
417 #define HA_ERR_INDEX_FILE_FULL 136
418 #define HA_ERR_END_OF_FILE 137
419 #define HA_ERR_UNSUPPORTED 138
420 #define HA_ERR_TO_BIG_ROW 139
421 #define HA_WRONG_CREATE_OPTION 140
422 #define HA_ERR_FOUND_DUPP_UNIQUE 141
423 #define HA_ERR_UNKNOWN_CHARSET 142
424 #define HA_ERR_WRONG_MRG_TABLE_DEF 143
425 #define HA_ERR_CRASHED_ON_REPAIR 144
426 #define HA_ERR_CRASHED_ON_USAGE 145
427 #define HA_ERR_LOCK_WAIT_TIMEOUT 146
428 #define HA_ERR_LOCK_TABLE_FULL 147
429 #define HA_ERR_READ_ONLY_TRANSACTION 148
430 #define HA_ERR_LOCK_DEADLOCK 149
431 #define HA_ERR_CANNOT_ADD_FOREIGN 150
432 #define HA_ERR_NO_REFERENCED_ROW 151
433 #define HA_ERR_ROW_IS_REFERENCED 152
434 #define HA_ERR_NO_SAVEPOINT 153
435 #define HA_ERR_NON_UNIQUE_BLOCK_SIZE 154
436 #define HA_ERR_NO_SUCH_TABLE 155
437 #define HA_ERR_TABLE_EXIST 156
438 #define HA_ERR_NO_CONNECTION 157
440 #define HA_ERR_NULL_IN_SPATIAL 158
441 #define HA_ERR_TABLE_DEF_CHANGED 159
443 #define HA_ERR_NO_PARTITION_FOUND 160
444 #define HA_ERR_RBR_LOGGING_FAILED 161
445 #define HA_ERR_DROP_INDEX_FK 162
450 #define HA_ERR_FOREIGN_DUPLICATE_KEY 163
452 #define HA_ERR_TABLE_NEEDS_UPGRADE 164
453 #define HA_ERR_TABLE_READONLY 165
455 #define HA_ERR_AUTOINC_READ_FAILED 166
456 #define HA_ERR_AUTOINC_ERANGE 167
457 #define HA_ERR_GENERIC 168
459 #define HA_ERR_RECORD_IS_THE_SAME 169
461 #define HA_ERR_LOGGING_IMPOSSIBLE 170
463 #define HA_ERR_CORRUPT_EVENT 171
465 #define HA_ERR_NEW_FILE 172
466 #define HA_ERR_ROWS_EVENT_APPLY 173
468 #define HA_ERR_INITIALIZATION 174
469 #define HA_ERR_FILE_TOO_SHORT 175
470 #define HA_ERR_WRONG_CRC 176
471 #define HA_ERR_TOO_MANY_CONCURRENT_TRXS 177
473 #define HA_ERR_NOT_IN_LOCK_PARTITIONS 178
474 #define HA_ERR_INDEX_COL_TOO_LONG 179
475 #define HA_ERR_INDEX_CORRUPT 180
476 #define HA_ERR_UNDO_REC_TOO_BIG 181
477 #define HA_FTS_INVALID_DOCID 182
478 #define HA_ERR_TABLE_IN_FK_CHECK 183
479 #define HA_ERR_TABLESPACE_EXISTS 184
480 #define HA_ERR_TOO_MANY_FIELDS 185
481 #define HA_ERR_ROW_IN_WRONG_PARTITION 186
482 #define HA_ERR_INNODB_READ_ONLY 187
483 #define HA_ERR_FTS_EXCEED_RESULT_CACHE_LIMIT 188
484 #define HA_ERR_LAST 188
487 #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
491 #define HA_NAMELEN 64
492 #define NO_SUCH_KEY (~(uint)0)
494 typedef ulong key_part_map;
495 #define HA_WHOLE_KEY (~(key_part_map)0)
500 #define SEARCH_FIND 1
501 #define SEARCH_NO_FIND 2
502 #define SEARCH_SAME 4
503 #define SEARCH_BIGGER 8
504 #define SEARCH_SMALLER 16
505 #define SEARCH_SAVE_BUFF 32
506 #define SEARCH_UPDATE 64
507 #define SEARCH_PREFIX 128
508 #define SEARCH_LAST 256
509 #define MBR_CONTAIN 512
510 #define MBR_INTERSECT 1024
511 #define MBR_WITHIN 2048
512 #define MBR_DISJOINT 4096
513 #define MBR_EQUAL 8192
514 #define MBR_DATA 16384
515 #define SEARCH_NULL_ARE_EQUAL 32768
516 #define SEARCH_NULL_ARE_NOT_EQUAL 65536
520 #define READ_CACHE_USED 2
521 #define READ_CHECK_USED 4
522 #define KEY_READ_USED 8
523 #define WRITE_CACHE_USED 16
524 #define OPT_NO_ROWS 32
527 #define HA_STATE_CHANGED 1
528 #define HA_STATE_AKTIV 2
529 #define HA_STATE_WRITTEN 4
530 #define HA_STATE_DELETED 8
531 #define HA_STATE_NEXT_FOUND 16
532 #define HA_STATE_PREV_FOUND 32
533 #define HA_STATE_NO_KEY 64
534 #define HA_STATE_KEY_CHANGED 128
535 #define HA_STATE_WRITE_AT_END 256
536 #define HA_STATE_BUFF_SAVED 512
537 #define HA_STATE_ROW_CHANGED 1024
538 #define HA_STATE_EXTEND_BLOCK 2048
539 #define HA_STATE_RNEXT_SAME 4096
543 FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE,
544 FIELD_SKIP_ZERO,FIELD_BLOB,FIELD_CONSTANT,FIELD_INTERVALL,FIELD_ZERO,
545 FIELD_VARCHAR,FIELD_CHECK,
549 enum data_file_type {
550 STATIC_RECORD, DYNAMIC_RECORD, COMPRESSED_RECORD, BLOCK_RECORD
555 enum key_range_flag {
556 NO_MIN_RANGE= 1 << 0,
557 NO_MAX_RANGE= 1 << 1,
567 UNIQUE_RANGE= 1 << 4,
586 USE_INDEX_STATISTICS= 1 << 9
594 key_part_map keypart_map;
595 enum ha_rkey_function flag;
609 #define rows2double(A) ulonglong2double(A)
610 typedef my_off_t ha_rows;
612 #define rows2double(A) (double) (A)
613 typedef ulong ha_rows;
616 #define HA_POS_ERROR (~ (ha_rows) 0)
617 #define HA_OFFSET_ERROR (~ (my_off_t) 0)
619 #if SYSTEM_SIZEOF_OFF_T == 4
620 #define MAX_FILE_SIZE INT_MAX32
622 #define MAX_FILE_SIZE LONGLONG_MAX
625 #define HA_VARCHAR_PACKLENGTH(field_length) ((field_length) < 256 ? 1 :2)
629 typedef void (* invalidator_by_filename)(
const char * filename);