379
381
#define IS_EQUAL_PACK_LENGTH 2
383
Query type constants.
385
QT_ORDINARY -- ordinary SQL query.
386
QT_IS -- SQL query to be shown in INFORMATION_SCHEMA (in utf8 and without
387
character set introducers).
391
Move this out of here once Stew's done with UDF breakout. The following headers need it:
393
sql_lex.h --> included by sql_class.h
411
* @TODO Move to a separate header?
413
* It's needed by item.h and field.h, which are both inter-dependent
414
* and contain forward declarations of many structs/classes in the
417
* What is needed is a separate header file that is included
418
* by *both* item.h and field.h to resolve inter-dependencies
420
* But, probably want to hold off on this until Stew finished the UDF cleanup
424
DERIVATION_IGNORABLE= 5,
425
DERIVATION_COERCIBLE= 4,
426
DERIVATION_SYSCONST= 3,
427
DERIVATION_IMPLICIT= 2,
429
DERIVATION_EXPLICIT= 0
433
* Opening modes for open_temporary_table and open_table_from_share
435
* @TODO Put this into an appropriate header. It is only needed in:
447
enum enum_parsing_place
456
enum enum_mysql_completiontype {
459
, ROLLBACK_AND_CHAIN= 7
462
, COMMIT_AND_CHAIN= 6
465
enum enum_check_fields
469
, CHECK_FIELD_ERROR_FOR_NULL
480
typedef uint64_t query_id_t;
483
The maximum is defined as (ULONG_MAX/1000) with 4 bytes uint32_t
485
const uint32_t SLAVE_MAX_HEARTBEAT_PERIOD= 4294967;
487
#define SLAVE_NET_TIMEOUT 3600
489
#define MAX_SLAVE_ERROR 2000
491
/* masks for start/stop operations on io and sql slave threads */
496
#define NO_HASH /* Not yet implemented */
499
// the following is for checking tables
501
#define HA_ADMIN_ALREADY_DONE 1
502
#define HA_ADMIN_OK 0
503
#define HA_ADMIN_NOT_IMPLEMENTED -1
504
#define HA_ADMIN_FAILED -2
505
#define HA_ADMIN_CORRUPT -3
506
#define HA_ADMIN_INTERNAL_ERROR -4
507
#define HA_ADMIN_INVALID -5
508
#define HA_ADMIN_REJECT -6
509
#define HA_ADMIN_TRY_ALTER -7
510
#define HA_ADMIN_WRONG_CHECKSUM -8
511
#define HA_ADMIN_NOT_BASE_TABLE -9
512
#define HA_ADMIN_NEEDS_UPGRADE -10
513
#define HA_ADMIN_NEEDS_ALTER -11
514
#define HA_ADMIN_NEEDS_CHECK -12
517
#define HA_ADD_INDEX (0)
518
#define HA_DROP_INDEX (1)
519
#define HA_ALTER_INDEX (2)
520
#define HA_RENAME_INDEX (3)
521
#define HA_ADD_UNIQUE_INDEX (4)
522
#define HA_DROP_UNIQUE_INDEX (5)
523
#define HA_ALTER_UNIQUE_INDEX (6)
524
#define HA_RENAME_UNIQUE_INDEX (7)
525
#define HA_ADD_PK_INDEX (8)
526
#define HA_DROP_PK_INDEX (9)
527
#define HA_ALTER_PK_INDEX (10)
528
#define HA_ADD_COLUMN (11)
529
#define HA_DROP_COLUMN (12)
530
#define HA_CHANGE_COLUMN (13)
531
#define HA_ALTER_COLUMN_NAME (14)
532
#define HA_ALTER_COLUMN_TYPE (15)
533
#define HA_ALTER_COLUMN_ORDER (16)
534
#define HA_ALTER_COLUMN_NULLABLE (17)
535
#define HA_COLUMN_DEFAULT_VALUE (18)
536
#define HA_COLUMN_STORAGE (19)
537
#define HA_COLUMN_FORMAT (20)
538
#define HA_ADD_FOREIGN_KEY (21)
539
#define HA_DROP_FOREIGN_KEY (22)
540
#define HA_ALTER_FOREIGN_KEY (23)
541
#define HA_ADD_CONSTRAINT (24)
542
#define HA_CHANGE_CHARACTER_SET (30)
543
#define HA_SET_DEFAULT_CHARACTER_SET (31)
544
#define HA_CHANGE_AUTOINCREMENT_VALUE (32)
545
#define HA_ALTER_STORAGE (33)
546
#define HA_ALTER_TABLESPACE (34)
547
#define HA_ALTER_ROW_FORMAT (35)
548
#define HA_RENAME_TABLE (36)
549
#define HA_ALTER_STORAGE_ENGINE (37)
550
#define HA_RECREATE (38)
551
#define HA_ALTER_STORED_VCOL (39)
552
/* Remember to increase HA_MAX_ALTER_FLAGS when adding more flags! */
554
/* Return values for check_if_supported_alter */
556
#define HA_ALTER_ERROR -1
557
#define HA_ALTER_SUPPORTED_WAIT_LOCK 0
558
#define HA_ALTER_SUPPORTED_NO_LOCK 1
559
#define HA_ALTER_NOT_SUPPORTED 2
561
/* Bits in table_flags() to show what database can do */
563
#define HA_NO_TRANSACTIONS (1 << 0) /* Doesn't support transactions */
564
#define HA_PARTIAL_COLUMN_READ (1 << 1) /* read may not return all columns */
565
#define HA_TABLE_SCAN_ON_INDEX (1 << 2) /* No separate data/index file */
567
The following should be set if the following is not true when scanning
568
a table with rnd_next()
569
- We will see all rows (including deleted ones)
570
- Row positions are 'table->s->db_record_offset' apart
571
If this flag is not set, filesort will do a postion() call for each matched
572
row to be able to find the row later.
574
#define HA_REC_NOT_IN_SEQ (1 << 3)
577
Reading keys in random order is as fast as reading keys in sort order
578
(Used in records.cc to decide if we should use a record cache and by
579
filesort to decide if we should sort key + data or key + pointer-to-row
581
#define HA_FAST_KEY_READ (1 << 5)
583
Set the following flag if we on delete should force all key to be read
584
and on update read all keys that changes
586
#define HA_REQUIRES_KEY_COLUMNS_FOR_DELETE (1 << 6)
587
#define HA_NULL_IN_KEY (1 << 7) /* One can have keys with NULL */
588
#define HA_DUPLICATE_POS (1 << 8) /* ha_position() gives dup row */
589
#define HA_NO_BLOBS (1 << 9) /* Doesn't support blobs */
590
#define HA_CAN_INDEX_BLOBS (1 << 10)
591
#define HA_AUTO_PART_KEY (1 << 11) /* auto-increment in multi-part key */
592
#define HA_REQUIRE_PRIMARY_KEY (1 << 12) /* .. and can't create a hidden one */
593
#define HA_STATS_RECORDS_IS_EXACT (1 << 13) /* stats.records is exact */
595
If we get the primary key columns for free when we do an index read
596
It also implies that we have to retrive the primary key when using
597
position() and rnd_pos().
599
#define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)
601
If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position()
602
uses a primary key. Without primary key, we can't call position().
604
#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1 << 16)
605
#define HA_NOT_DELETE_WITH_CACHE (1 << 18)
607
The following is we need to a primary key to delete (and update) a row.
608
If there is no primary key, all columns needs to be read on update and delete
610
#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE (1 << 19)
611
#define HA_NO_PREFIX_CHAR_KEYS (1 << 20)
612
#define HA_NO_AUTO_INCREMENT (1 << 23)
613
#define HA_HAS_CHECKSUM (1 << 24)
614
/* Table data are stored in separate files (for lower_case_table_names) */
615
#define HA_FILE_BASED (1 << 26)
616
#define HA_NEED_READ_RANGE_BUFFER (1 << 29) /* for read_multi_range */
617
#define HA_ANY_INDEX_MAY_BE_UNIQUE (1 << 30)
618
#define HA_NO_COPY_ON_ALTER (INT64_C(1) << 31)
619
#define HA_HAS_RECORDS (INT64_C(1) << 32) /* records() gives exact count*/
620
#define HA_MRR_CANT_SORT (INT64_C(1) << 34)
623
Engine is capable of row-format and statement-format logging,
626
#define HA_BINLOG_ROW_CAPABLE (INT64_C(1) << 35)
627
#define HA_BINLOG_STMT_CAPABLE (INT64_C(1) << 36)
629
#define HA_ONLINE_ALTER (INT64_C(1) << 37)
632
Set of all binlog flags. Currently only contain the capabilities
635
#define HA_BINLOG_FLAGS (HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE)
637
/* bits in index_flags(index_number) for what you can do with index */
638
#define HA_READ_NEXT 1 /* TODO really use this flag */
639
#define HA_READ_PREV 2 /* supports ::index_prev */
640
#define HA_READ_ORDER 4 /* index_next/prev follow sort order */
641
#define HA_READ_RANGE 8 /* can find all records in a range */
642
#define HA_ONLY_WHOLE_INDEX 16 /* Can't use part key searches */
643
#define HA_KEYREAD_ONLY 64 /* Support HA_EXTRA_KEYREAD */
645
Index scan will not return records in rowid order. Not guaranteed to be
646
set for unordered (e.g. HASH) indexes.
648
#define HA_KEY_SCAN_NOT_ROR 128
649
#define HA_DO_INDEX_COND_PUSHDOWN 256 /* Supports Index Condition Pushdown */
654
HA_PARTITION_FUNCTION_SUPPORTED indicates that the function is
656
HA_FAST_CHANGE_PARTITION means that optimised variants of the changes
657
exists but they are not necessarily done online.
659
HA_ONLINE_DOUBLE_WRITE means that the handler supports writing to both
660
the new partition and to the old partitions when updating through the
661
old partitioning schema while performing a change of the partitioning.
662
This means that we can support updating of the table while performing
663
the copy phase of the change. For no lock at all also a double write
664
from new to old must exist and this is not required when this flag is
666
This is actually removed even before it was introduced the first time.
667
The new idea is that handlers will handle the lock level already in
668
store_lock for ALTER Table partitions.
670
HA_PARTITION_ONE_PHASE is a flag that can be set by handlers that take
671
care of changing the partitions online and in one phase. Thus all phases
672
needed to handle the change are implemented inside the storage engine.
673
The storage engine must also support auto-discovery since the frm file
674
is changed as part of the change and this change must be controlled by
675
the storage engine. A typical engine to support this is NDB (through
678
#define HA_PARTITION_FUNCTION_SUPPORTED (1L << 1)
679
#define HA_FAST_CHANGE_PARTITION (1L << 2)
680
#define HA_PARTITION_ONE_PHASE (1L << 3)
682
/* operations for disable/enable indexes */
683
#define HA_KEY_SWITCH_NONUNIQ 0
684
#define HA_KEY_SWITCH_ALL 1
685
#define HA_KEY_SWITCH_NONUNIQ_SAVE 2
686
#define HA_KEY_SWITCH_ALL_SAVE 3
689
Note: the following includes binlog and closing 0.
690
so: innodb + bdb + ndb + binlog + myisam + myisammrg + archive +
691
example + csv + heap + blackhole + federated + 0
692
(yes, the sum is deliberately inaccurate)
693
TODO remove the limit, use dynarrays
698
Parameters for open() (in register form->filestat)
699
HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED
702
#define HA_OPEN_KEYFILE 1
703
#define HA_OPEN_RNDFILE 2
704
#define HA_GET_INDEX 4
705
#define HA_GET_INFO 8 /* do a ha_info() after open */
706
#define HA_READ_ONLY 16 /* File opened as readonly */
707
/* Try readonly if can't open with read and write */
708
#define HA_TRY_READ_ONLY 32
709
#define HA_WAIT_IF_LOCKED 64 /* Wait if locked on open */
710
#define HA_ABORT_IF_LOCKED 128 /* skip if locked on open.*/
711
#define HA_BLOCK_LOCK 256 /* unlock when reading some records */
712
#define HA_OPEN_TEMPORARY 512
714
/* For transactional LOCK Table. handler::lock_table() */
715
#define HA_LOCK_IN_SHARE_MODE F_RDLCK
716
#define HA_LOCK_IN_EXCLUSIVE_MODE F_WRLCK
718
/* Some key definitions */
719
#define HA_KEY_NULL_LENGTH 1
720
#define HA_KEY_BLOB_LENGTH 2
722
#define HA_LEX_CREATE_TMP_TABLE 1
723
#define HA_LEX_CREATE_IF_NOT_EXISTS 2
724
#define HA_LEX_CREATE_TABLE_LIKE 4
725
#define HA_OPTION_NO_CHECKSUM (1L << 17)
726
#define HA_OPTION_NO_DELAY_KEY_WRITE (1L << 18)
727
#define HA_MAX_REC_LENGTH 65535
729
/* Table caching type */
730
#define HA_CACHE_TBL_NONTRANSACT 0
731
#define HA_CACHE_TBL_NOCACHE 1
732
#define HA_CACHE_TBL_ASKTRANSACT 2
733
#define HA_CACHE_TBL_TRANSACT 4
735
/* Options of START TRANSACTION statement (and later of SET TRANSACTION stmt) */
736
#define DRIZZLE_START_TRANS_OPT_WITH_CONS_SNAPSHOT 1
738
/* Flags for method is_fatal_error */
739
#define HA_CHECK_DUP_KEY 1
740
#define HA_CHECK_DUP_UNIQUE 2
741
#define HA_CHECK_DUP (HA_CHECK_DUP_KEY + HA_CHECK_DUP_UNIQUE)
746
DB_TYPE_FIRST_DYNAMIC=42,
747
DB_TYPE_DEFAULT=127 // Must be last
750
enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
751
ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED,
752
ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT, ROW_TYPE_PAGE };
754
enum column_format_type { COLUMN_FORMAT_TYPE_NOT_USED= -1,
755
COLUMN_FORMAT_TYPE_DEFAULT= 0,
756
COLUMN_FORMAT_TYPE_FIXED= 1,
757
COLUMN_FORMAT_TYPE_DYNAMIC= 2 };
759
enum enum_binlog_func {
764
BFN_BINLOG_PURGE_FILE= 5
767
enum enum_binlog_command {
777
/* struct to hold information about the table that should be created */
779
/* Bits in used_fields */
780
#define HA_CREATE_USED_AUTO (1L << 0)
782
#define HA_CREATE_USED_UNION (1L << 2)
783
#define HA_CREATE_USED_PASSWORD (1L << 17)
785
#define HA_CREATE_USED_INSERT_METHOD (1L << 3)
786
#define HA_CREATE_USED_MIN_ROWS (1L << 4)
787
#define HA_CREATE_USED_MAX_ROWS (1L << 5)
788
#define HA_CREATE_USED_AVG_ROW_LENGTH (1L << 6)
789
#define HA_CREATE_USED_PACK_KEYS (1L << 7)
790
#define HA_CREATE_USED_CHARSET (1L << 8)
791
#define HA_CREATE_USED_DEFAULT_CHARSET (1L << 9)
792
#define HA_CREATE_USED_DATADIR (1L << 10)
793
#define HA_CREATE_USED_INDEXDIR (1L << 11)
794
#define HA_CREATE_USED_ENGINE (1L << 12)
795
#define HA_CREATE_USED_CHECKSUM (1L << 13)
796
#define HA_CREATE_USED_DELAY_KEY_WRITE (1L << 14)
797
#define HA_CREATE_USED_ROW_FORMAT (1L << 15)
798
#define HA_CREATE_USED_COMMENT (1L << 16)
799
#define HA_CREATE_USED_CONNECTION (1L << 18)
800
#define HA_CREATE_USED_KEY_BLOCK_SIZE (1L << 19)
801
#define HA_CREATE_USED_PAGE_CHECKSUM (1L << 21)
802
#define HA_CREATE_USED_BLOCK_SIZE (1L << 22)
804
#define MAXGTRIDSIZE 64
805
#define MAXBQUALSIZE 64
807
#define COMPATIBLE_DATA_YES 0
808
#define COMPATIBLE_DATA_NO 1
810
#define UNDEF_NODEGROUP 65535
811
#define NOT_A_PARTITION_ID ((uint32_t)-1)
813
enum ha_choice { HA_CHOICE_UNDEF, HA_CHOICE_NO, HA_CHOICE_YES };
815
/* Possible flags of a handlerton (there can be 32 of them) */
816
#define HTON_NO_FLAGS 0
817
#define HTON_CLOSE_CURSORS_AT_COMMIT (1 << 0)
818
#define HTON_ALTER_NOT_SUPPORTED (1 << 1) //Engine does not support alter
819
#define HTON_CAN_RECREATE (1 << 2) //Delete all is used fro truncate
820
#define HTON_HIDDEN (1 << 3) //Engine does not appear in lists
821
#define HTON_FLUSH_AFTER_RENAME (1 << 4)
822
#define HTON_NOT_USER_SELECTABLE (1 << 5)
823
#define HTON_TEMPORARY_NOT_SUPPORTED (1 << 6) //Having temporary tables not supported
824
#define HTON_SUPPORT_LOG_TABLES (1 << 7) //Engine supports log tables
825
#define HTON_NO_PARTITION (1 << 8) //You can not partition these tables
827
The below two are not used (and not handled) in this milestone of this WL
828
entry because there seems to be no use for them at this stage of
831
#define HA_MRR_SINGLE_POINT 1
832
#define HA_MRR_FIXED_KEY 2
835
Indicates that RANGE_SEQ_IF::next(&range) doesn't need to fill in the
838
#define HA_MRR_NO_ASSOCIATION 4
841
The MRR user will provide ranges in key order, and MRR implementation
842
must return rows in key order.
844
#define HA_MRR_SORTED 8
846
/* MRR implementation doesn't have to retrieve full records */
847
#define HA_MRR_INDEX_ONLY 16
850
The passed memory buffer is of maximum possible size, the caller can't
851
assume larger buffer.
853
#define HA_MRR_LIMITS 32
857
Flag set <=> default MRR implementation is used
858
(The choice is made by **_info[_const]() function which may set this
859
flag. SQL layer remembers the flag value and then passes it to
860
multi_read_range_init().
862
#define HA_MRR_USE_DEFAULT_IMPL 64
865
Used only as parameter to multi_range_read_info():
866
Flag set <=> the caller guarantees that the bounds of the scanned ranges
867
will not have NULL values.
869
#define HA_MRR_NO_NULL_ENDPOINTS 128
871
384
#endif /* DRIZZLE_SERVER_DEFINITIONS_H */