329
496
#define HA_ADMIN_INTERNAL_ERROR -4
330
497
#define HA_ADMIN_INVALID -5
331
498
#define HA_ADMIN_REJECT -6
499
#define HA_ADMIN_TRY_ALTER -7
500
#define HA_ADMIN_NEEDS_UPGRADE -10
501
#define HA_ADMIN_NEEDS_ALTER -11
502
#define HA_ADMIN_NEEDS_CHECK -12
505
#define HA_ADD_INDEX (0)
506
#define HA_DROP_INDEX (1)
507
#define HA_ALTER_INDEX (2)
508
#define HA_RENAME_INDEX (3)
509
#define HA_ADD_UNIQUE_INDEX (4)
510
#define HA_DROP_UNIQUE_INDEX (5)
511
#define HA_ALTER_UNIQUE_INDEX (6)
512
#define HA_RENAME_UNIQUE_INDEX (7)
513
#define HA_ADD_PK_INDEX (8)
514
#define HA_DROP_PK_INDEX (9)
515
#define HA_ALTER_PK_INDEX (10)
516
#define HA_ADD_COLUMN (11)
517
#define HA_DROP_COLUMN (12)
518
#define HA_CHANGE_COLUMN (13)
519
#define HA_ALTER_COLUMN_NAME (14)
520
#define HA_ALTER_COLUMN_TYPE (15)
521
#define HA_ALTER_COLUMN_ORDER (16)
522
#define HA_ALTER_COLUMN_NULLABLE (17)
523
#define HA_COLUMN_DEFAULT_VALUE (18)
524
#define HA_COLUMN_STORAGE (19)
525
#define HA_COLUMN_FORMAT (20)
526
#define HA_ADD_FOREIGN_KEY (21)
527
#define HA_DROP_FOREIGN_KEY (22)
528
#define HA_ALTER_FOREIGN_KEY (23)
529
#define HA_ADD_CONSTRAINT (24)
530
#define HA_CHANGE_CHARACTER_SET (30)
531
#define HA_SET_DEFAULT_CHARACTER_SET (31)
532
#define HA_CHANGE_AUTOINCREMENT_VALUE (32)
533
#define HA_ALTER_STORAGE (33)
534
#define HA_ALTER_TABLESPACE (34)
535
#define HA_ALTER_ROW_FORMAT (35)
536
#define HA_RENAME_TABLE (36)
537
#define HA_ALTER_STORAGE_ENGINE (37)
538
#define HA_RECREATE (38)
539
#define HA_ALTER_STORED_VCOL (39)
540
/* Remember to increase HA_MAX_ALTER_FLAGS when adding more flags! */
542
/* Return values for check_if_supported_alter */
544
#define HA_ALTER_ERROR -1
545
#define HA_ALTER_SUPPORTED_WAIT_LOCK 0
546
#define HA_ALTER_SUPPORTED_NO_LOCK 1
547
#define HA_ALTER_NOT_SUPPORTED 2
549
/* Bits in table_flags() to show what database can do */
551
#define HA_NO_TRANSACTIONS (1 << 0) /* Doesn't support transactions */
552
#define HA_PARTIAL_COLUMN_READ (1 << 1) /* read may not return all columns */
553
#define HA_TABLE_SCAN_ON_INDEX (1 << 2) /* No separate data/index file */
555
The following should be set if the following is not true when scanning
556
a table with rnd_next()
557
- We will see all rows (including deleted ones)
558
- Row positions are 'table->s->db_record_offset' apart
559
If this flag is not set, filesort will do a postion() call for each matched
560
row to be able to find the row later.
562
#define HA_REC_NOT_IN_SEQ (1 << 3)
565
Reading keys in random order is as fast as reading keys in sort order
566
(Used in records.cc to decide if we should use a record cache and by
567
filesort to decide if we should sort key + data or key + pointer-to-row
569
#define HA_FAST_KEY_READ (1 << 5)
571
Set the following flag if we on delete should force all key to be read
572
and on update read all keys that changes
574
#define HA_REQUIRES_KEY_COLUMNS_FOR_DELETE (1 << 6)
575
#define HA_NULL_IN_KEY (1 << 7) /* One can have keys with NULL */
576
#define HA_DUPLICATE_POS (1 << 8) /* ha_position() gives dup row */
577
#define HA_NO_BLOBS (1 << 9) /* Doesn't support blobs */
578
#define HA_CAN_INDEX_BLOBS (1 << 10)
579
#define HA_AUTO_PART_KEY (1 << 11) /* auto-increment in multi-part key */
580
#define HA_REQUIRE_PRIMARY_KEY (1 << 12) /* .. and can't create a hidden one */
581
#define HA_STATS_RECORDS_IS_EXACT (1 << 13) /* stats.records is exact */
583
If we get the primary key columns for free when we do an index read
584
It also implies that we have to retrive the primary key when using
585
position() and rnd_pos().
587
#define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)
589
If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position()
590
uses a primary key. Without primary key, we can't call position().
592
#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1 << 16)
333
593
#define HA_NOT_DELETE_WITH_CACHE (1 << 18)
595
The following is we need to a primary key to delete (and update) a row.
596
If there is no primary key, all columns needs to be read on update and delete
598
#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE (1 << 19)
599
#define HA_NO_PREFIX_CHAR_KEYS (1 << 20)
600
#define HA_NO_AUTO_INCREMENT (1 << 23)
601
#define HA_HAS_CHECKSUM (1 << 24)
602
/* Table data are stored in separate files (for lower_case_table_names) */
603
#define HA_FILE_BASED (1 << 26)
604
#define HA_NEED_READ_RANGE_BUFFER (1 << 29) /* for read_multi_range */
605
#define HA_ANY_INDEX_MAY_BE_UNIQUE (1 << 30)
606
#define HA_NO_COPY_ON_ALTER (INT64_C(1) << 31)
607
#define HA_HAS_RECORDS (INT64_C(1) << 32) /* records() gives exact count*/
608
#define HA_MRR_CANT_SORT (INT64_C(1) << 34)
611
Engine is capable of row-format and statement-format logging,
614
#define HA_BINLOG_ROW_CAPABLE (INT64_C(1) << 35)
615
#define HA_BINLOG_STMT_CAPABLE (INT64_C(1) << 36)
617
#define HA_ONLINE_ALTER (INT64_C(1) << 37)
620
Set of all binlog flags. Currently only contain the capabilities
623
#define HA_BINLOG_FLAGS (HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE)
335
625
/* bits in index_flags(index_number) for what you can do with index */
336
626
#define HA_READ_NEXT 1 /* TODO really use this flag */
386
676
#define HA_KEY_NULL_LENGTH 1
387
677
#define HA_KEY_BLOB_LENGTH 2
679
#define HA_LEX_CREATE_TMP_TABLE 1
680
#define HA_LEX_CREATE_IF_NOT_EXISTS 2
681
#define HA_LEX_CREATE_TABLE_LIKE 4
682
#define HA_OPTION_NO_CHECKSUM (1L << 17)
683
#define HA_OPTION_NO_DELAY_KEY_WRITE (1L << 18)
389
684
#define HA_MAX_REC_LENGTH 65535
686
/* Table caching type */
687
#define HA_CACHE_TBL_NONTRANSACT 0
688
#define HA_CACHE_TBL_NOCACHE 1
689
#define HA_CACHE_TBL_ASKTRANSACT 2
690
#define HA_CACHE_TBL_TRANSACT 4
391
692
/* Options of START TRANSACTION statement (and later of SET TRANSACTION stmt) */
392
enum start_transaction_option_t
394
START_TRANS_NO_OPTIONS,
395
START_TRANS_OPT_WITH_CONS_SNAPSHOT
693
#define DRIZZLE_START_TRANS_OPT_WITH_CONS_SNAPSHOT 1
398
695
/* Flags for method is_fatal_error */
399
696
#define HA_CHECK_DUP_KEY 1
400
697
#define HA_CHECK_DUP_UNIQUE 2
401
698
#define HA_CHECK_DUP (HA_CHECK_DUP_KEY + HA_CHECK_DUP_UNIQUE)
703
DB_TYPE_FIRST_DYNAMIC=42,
704
DB_TYPE_DEFAULT=127 // Must be last
707
enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
708
ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED,
709
ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT, ROW_TYPE_PAGE };
711
enum column_format_type { COLUMN_FORMAT_TYPE_NOT_USED= -1,
712
COLUMN_FORMAT_TYPE_DEFAULT= 0,
713
COLUMN_FORMAT_TYPE_FIXED= 1,
714
COLUMN_FORMAT_TYPE_DYNAMIC= 2 };
716
enum enum_binlog_func {
721
BFN_BINLOG_PURGE_FILE= 5
724
enum enum_binlog_command {
734
/* struct to hold information about the table that should be created */
404
736
/* Bits in used_fields */
405
737
#define HA_CREATE_USED_AUTO (1L << 0)
739
#define HA_CREATE_USED_UNION (1L << 2)
740
#define HA_CREATE_USED_PASSWORD (1L << 17)
742
#define HA_CREATE_USED_INSERT_METHOD (1L << 3)
743
#define HA_CREATE_USED_MIN_ROWS (1L << 4)
744
#define HA_CREATE_USED_MAX_ROWS (1L << 5)
745
#define HA_CREATE_USED_AVG_ROW_LENGTH (1L << 6)
746
#define HA_CREATE_USED_PACK_KEYS (1L << 7)
406
747
#define HA_CREATE_USED_CHARSET (1L << 8)
407
748
#define HA_CREATE_USED_DEFAULT_CHARSET (1L << 9)
749
#define HA_CREATE_USED_DATADIR (1L << 10)
750
#define HA_CREATE_USED_INDEXDIR (1L << 11)
751
#define HA_CREATE_USED_ENGINE (1L << 12)
752
#define HA_CREATE_USED_CHECKSUM (1L << 13)
753
#define HA_CREATE_USED_DELAY_KEY_WRITE (1L << 14)
408
754
#define HA_CREATE_USED_ROW_FORMAT (1L << 15)
755
#define HA_CREATE_USED_COMMENT (1L << 16)
756
#define HA_CREATE_USED_CONNECTION (1L << 18)
409
757
#define HA_CREATE_USED_KEY_BLOCK_SIZE (1L << 19)
758
#define HA_CREATE_USED_PAGE_CHECKSUM (1L << 21)
410
759
#define HA_CREATE_USED_BLOCK_SIZE (1L << 22)
412
761
#define MAXGTRIDSIZE 64
413
762
#define MAXBQUALSIZE 64
764
#define COMPATIBLE_DATA_YES 0
765
#define COMPATIBLE_DATA_NO 1
767
#define UNDEF_NODEGROUP 65535
768
#define NOT_A_PARTITION_ID ((uint32_t)-1)
770
enum ha_choice { HA_CHOICE_UNDEF, HA_CHOICE_NO, HA_CHOICE_YES };
416
773
The below two are not used (and not handled) in this milestone of this WL
417
774
entry because there seems to be no use for them at this stage of
451
808
#define HA_MRR_USE_DEFAULT_IMPL 64
811
Used only as parameter to multi_range_read_info():
812
Flag set <=> the caller guarantees that the bounds of the scanned ranges
813
will not have NULL values.
815
#define HA_MRR_NO_NULL_ENDPOINTS 128
817
enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME };
819
enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED,
820
ISO_REPEATABLE_READ, ISO_SERIALIZABLE};
823
enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED};
454
826
#define MYF(v) (myf) (v)
829
When a command is added here, be sure it's also added in mysqld.cc
830
in "struct show_var_st status_vars[]= {" ...
832
If the command returns a result set or is not allowed in stored
833
functions or triggers, please also make sure that
834
sp_get_flags_for_command (sp_head.cc) returns proper flags for the
838
enum enum_sql_command {
839
SQLCOM_SELECT, SQLCOM_CREATE_TABLE, SQLCOM_CREATE_INDEX, SQLCOM_ALTER_TABLE,
840
SQLCOM_UPDATE, SQLCOM_INSERT, SQLCOM_INSERT_SELECT,
841
SQLCOM_DELETE, SQLCOM_TRUNCATE, SQLCOM_DROP_TABLE, SQLCOM_DROP_INDEX,
842
SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
843
SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_STATUS,
844
SQLCOM_SHOW_ENGINE_LOGS, SQLCOM_SHOW_ENGINE_STATUS, SQLCOM_SHOW_ENGINE_MUTEX,
845
SQLCOM_SHOW_PROCESSLIST,
847
SQLCOM_SHOW_CREATE_DB,
848
SQLCOM_SHOW_TABLE_STATUS,
849
SQLCOM_LOAD,SQLCOM_SET_OPTION,SQLCOM_LOCK_TABLES,SQLCOM_UNLOCK_TABLES,
850
SQLCOM_CHANGE_DB, SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB,
851
SQLCOM_REPAIR, SQLCOM_REPLACE, SQLCOM_REPLACE_SELECT,
852
SQLCOM_OPTIMIZE, SQLCOM_CHECK,
853
SQLCOM_ASSIGN_TO_KEYCACHE,
854
SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_ANALYZE,
855
SQLCOM_ROLLBACK, SQLCOM_ROLLBACK_TO_SAVEPOINT,
856
SQLCOM_COMMIT, SQLCOM_SAVEPOINT, SQLCOM_RELEASE_SAVEPOINT,
857
SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP,
860
SQLCOM_SHOW_OPEN_TABLES,
861
SQLCOM_DELETE_MULTI, SQLCOM_UPDATE_MULTI,
868
When a command is added here, be sure it's also added in mysqld.cc
869
in "struct show_var_st status_vars[]= {" ...
871
/* This should be the last !!! */
875
enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_UPDATE };
877
enum release_type { RELEASE_NORMAL, RELEASE_WAIT_FOR_DROP };
880
Make sure that the order of schema_tables and enum_schema_tables are the same.
883
enum enum_schema_tables
887
SCH_COLLATION_CHARACTER_SET_APPLICABILITY,
890
SCH_GLOBAL_VARIABLES,
891
SCH_KEY_COLUMN_USAGE,
895
SCH_REFERENTIAL_CONSTRAINTS,
898
SCH_SESSION_VARIABLES,
902
SCH_TABLE_CONSTRAINTS,
456
908
#define MY_I_S_MAYBE_NULL 1
457
909
#define MY_I_S_UNSIGNED 2
912
#define SKIP_OPEN_TABLE 0 // do not open table
913
#define OPEN_FRM_ONLY 1 // open FRM file only
914
#define OPEN_FULL_TABLE 2 // open FRM,MYD, MYI files
461
917
"Declared Type Collation"
462
918
A combination of collation and its derivation.
478
934
#define MY_COLL_ALLOW_CONV 3
479
935
#define MY_COLL_DISALLOW_NONE 4
480
936
#define MY_COLL_CMP_CONV 7
940
This enum is used to report information about monotonicity of function
941
represented by Item* tree.
942
Monotonicity is defined only for Item* trees that represent table
943
partitioning expressions (i.e. have no subselects/user vars/PS parameters
944
etc etc). An Item* tree is assumed to have the same monotonicity properties
945
as its correspoinding function F:
947
[signed] int64_t F(field1, field2, ...) {
948
put values of field_i into table record buffer;
949
return item->val_int();
953
At the moment function monotonicity is not well defined (and so may be
954
incorrect) for Item trees with parameters/return types that are different
955
from INT_RESULT, may be NULL, or are unsigned.
956
It will be possible to address this issue once the related partitioning bugs
957
(BUG#16002, BUG#15447, BUG#13436) are fixed.
960
typedef enum monotonicity_info
962
NON_MONOTONIC, /* none of the below holds */
963
MONOTONIC_INCREASING, /* F() is unary and (x < y) => (F(x) <= F(y)) */
964
MONOTONIC_STRICT_INCREASING /* F() is unary and (x < y) => (F(x) < F(y)) */
965
} enum_monotonicity_info;
969
NO_TMP_TABLE, NON_TRANSACTIONAL_TMP_TABLE, TRANSACTIONAL_TMP_TABLE,
970
INTERNAL_TMP_TABLE, SYSTEM_TMP_TABLE, TMP_TABLE_FRM_FILE_ONLY
974
Values in this enum are used to indicate how a tables TIMESTAMP field
975
should be treated. It can be set to the current timestamp on insert or
977
WARNING: The values are used for bit operations. If you change the
978
enum, you must keep the bitwise relation of the values. For example:
979
(int) TIMESTAMP_AUTO_SET_ON_BOTH must be equal to
980
(int) TIMESTAMP_AUTO_SET_ON_INSERT | (int) TIMESTAMP_AUTO_SET_ON_UPDATE.
981
We use an enum here so that the debugger can display the value names.
983
enum timestamp_auto_set_type
985
TIMESTAMP_NO_AUTO_SET= 0, TIMESTAMP_AUTO_SET_ON_INSERT= 1,
986
TIMESTAMP_AUTO_SET_ON_UPDATE= 2, TIMESTAMP_AUTO_SET_ON_BOTH= 3
481
988
#define clear_timestamp_auto_bits(_target_, _bits_) \
482
989
(_target_)= (enum timestamp_auto_set_type)((int)(_target_) & ~(int)(_bits_))
992
Category of table found in the table share.
994
enum enum_table_category
999
TABLE_UNKNOWN_CATEGORY=0,
1003
The table is visible only in the session.
1005
- FLUSH TABLES WITH READ LOCK
1006
- SET GLOBAL READ_ONLY = ON
1007
do not apply to this table.
1008
Note that LOCK Table t FOR READ/WRITE
1009
can be used on temporary tables.
1010
Temporary tables are not part of the table cache.
1012
TABLE_CATEGORY_TEMPORARY=1,
1016
These tables do honor:
1017
- LOCK Table t FOR READ/WRITE
1018
- FLUSH TABLES WITH READ LOCK
1019
- SET GLOBAL READ_ONLY = ON
1020
User tables are cached in the table cache.
1022
TABLE_CATEGORY_USER=2,
1025
Information schema tables.
1026
These tables are an interface provided by the system
1027
to inspect the system metadata.
1028
These tables do *not* honor:
1029
- LOCK Table t FOR READ/WRITE
1030
- FLUSH TABLES WITH READ LOCK
1031
- SET GLOBAL READ_ONLY = ON
1032
as there is no point in locking explicitely
1033
an INFORMATION_SCHEMA table.
1034
Nothing is directly written to information schema tables.
1035
Note that this value is not used currently,
1036
since information schema tables are not shared,
1037
but implemented as session specific temporary tables.
1040
TODO: Fixing the performance issues of I_S will lead
1041
to I_S tables in the table cache, which should use
1044
TABLE_CATEGORY_INFORMATION
1047
enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
1048
enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON,
1049
DELAY_KEY_WRITE_ALL };
1050
enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT,
1051
SLAVE_EXEC_MODE_IDEMPOTENT,
1052
SLAVE_EXEC_MODE_LAST_BIT};
1053
enum enum_mark_columns
1054
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
1056
enum enum_filetype { FILETYPE_CSV, FILETYPE_XML };
1058
enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND,
1059
IGNORE_ERRORS, REPORT_EXCEPT_NON_UNIQUE,
1060
IGNORE_EXCEPT_NON_UNIQUE};
1062
enum enum_schema_table_state
1065
PROCESSED_BY_CREATE_SORT_INDEX,
1066
PROCESSED_BY_JOIN_EXEC
485
1070
* The following are for the interface with the .frm file
1073
#define FIELDFLAG_DECIMAL 1
1074
#define FIELDFLAG_BINARY 1 // Shares same flag
1075
#define FIELDFLAG_NUMBER 2
1076
#define FIELDFLAG_DECIMAL_POSITION 4
1077
#define FIELDFLAG_PACK 120 // Bits used for packing
1078
#define FIELDFLAG_INTERVAL 256 // mangled with decimals!
1079
#define FIELDFLAG_BLOB 1024 // mangled with decimals!
1081
#define FIELDFLAG_NO_DEFAULT 16384 /* sql */
1082
#define FIELDFLAG_SUM ((uint32_t) 32768)// predit: +#fieldflag
1083
#define FIELDFLAG_MAYBE_NULL ((uint32_t) 32768)// sql
1084
#define FIELDFLAG_HEX_ESCAPE ((uint32_t) 0x10000)
488
1085
#define FIELDFLAG_PACK_SHIFT 3
1086
#define FIELDFLAG_DEC_SHIFT 8
489
1087
#define FIELDFLAG_MAX_DEC 31
491
1089
#define MTYP_TYPENR(type) (type & 127) /* Remove bits from type */
1091
#define f_is_dec(x) ((x) & FIELDFLAG_DECIMAL)
1092
#define f_is_num(x) ((x) & FIELDFLAG_NUMBER)
1093
#define f_is_decimal_precision(x) ((x) & FIELDFLAG_DECIMAL_POSITION)
1094
#define f_is_packed(x) ((x) & FIELDFLAG_PACK)
493
1095
#define f_packtype(x) (((x) >> FIELDFLAG_PACK_SHIFT) & 15)
1096
#define f_decimals(x) ((uint8_t) (((x) >> FIELDFLAG_DEC_SHIFT) & \
1098
#define f_is_alpha(x) (!f_is_num(x))
1099
#define f_is_binary(x) ((x) & FIELDFLAG_BINARY) // 4.0- compatibility
1100
#define f_is_enum(x) (((x) & (FIELDFLAG_INTERVAL | FIELDFLAG_NUMBER)) == \
1102
#define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == \
1104
#define f_is_equ(x) ((x) & (1+2+FIELDFLAG_PACK+31*256))
494
1105
#define f_settype(x) (((int) x) << FIELDFLAG_PACK_SHIFT)
498
template <class T> void set_if_bigger(T &a, const T &b)
504
template <class T> void set_if_smaller(T &a, const T &b)
511
#define set_if_bigger(a,b) do { \
512
const typeof(a) _a = (a); \
513
const typeof(b) _b = (b); \
514
(void) (&_a == &_b); \
515
if ((a) < (b)) (a)=(b); \
517
#define set_if_smaller(a,b) do { \
518
const typeof(a) _a = (a); \
519
const typeof(b) _b = (b); \
520
(void) (&_a == &_b); \
521
if ((a) > (b)) (a)=(b); \
525
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
526
#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
531
#define array_elements(a) \
532
((sizeof(a) / sizeof(*(a))) / \
533
static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
536
/* Some types that is different between systems */
539
#define FN_LIBCHAR '/'
540
#define FN_ROOTDIR "/"
542
#define MY_NFILE 64 /* This is only used to save filenames */
543
#ifndef OS_FILE_LIMIT
544
#define OS_FILE_LIMIT 65535
548
How much overhead does malloc have. The code often allocates
549
something like 1024-MALLOC_OVERHEAD bytes
551
#define MALLOC_OVERHEAD 8
553
/* get memory in huncs */
554
static const uint32_t ONCE_ALLOC_INIT= 4096;
555
/* Typical record cash */
556
static const uint32_t RECORD_CACHE_SIZE= 64*1024;
557
/* Typical key cash */
558
static const uint32_t KEY_CACHE_SIZE= 8*1024*1024;
560
/* Default size of a key cache block */
561
static const uint32_t KEY_CACHE_BLOCK_SIZE= 1024;
564
/* Some things that this system doesn't have */
566
/* Some defines of functions for portability */
568
#undef remove /* Crashes MySQL on SCO 5.0.0 */
569
#ifndef uint64_t2double
570
#define uint64_t2double(A) ((double) (uint64_t) (A))
574
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
576
#define ulong_to_double(X) ((double) (ulong) (X))
578
#ifndef STACK_DIRECTION
579
#error "please add -DSTACK_DIRECTION=1 or -1 to your CPPFLAGS"
582
/* From limits.h instead */
584
#define DBL_MIN 4.94065645841246544e-324
587
#define DBL_MAX 1.79769313486231470e+308
591
/* Define missing math constants. */
593
#define M_PI 3.14159265358979323846
596
#define M_E 2.7182818284590452354
599
#define M_LN2 0.69314718055994530942
603
Max size that must be added to a so that we know Size to make
606
#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1))
607
#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double))
608
/* Size to make adressable obj. */
609
#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t)))
610
/* Offset of field f in structure t */
611
#define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f)
613
#define ADD_TO_PTR(ptr,size,type) (type) (reinterpret_cast<const unsigned char*>(ptr)+size)
614
#define PTR_BYTE_DIFF(A,B) (ptrdiff_t) (reinterpret_cast<const unsigned char*>(A) - reinterpret_cast<const unsigned char*>(B))
616
#define ADD_TO_PTR(ptr,size,type) (type) ((unsigned char*) (ptr)+size)
617
#define PTR_BYTE_DIFF(A,B) (ptrdiff_t) ((unsigned char*) (A) - (unsigned char*) (B))
620
#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B))
621
#define MY_ALIGNED_BYTE_ARRAY(N, S, T) T N[MY_DIV_UP(S, sizeof(T))]
623
/* Typdefs for easyier portability */
626
#if defined(SIZEOF_OFF_T)
627
# if (SIZEOF_OFF_T == 8)
628
# define OFF_T_MAX (INT64_MAX)
630
# define OFF_T_MAX (INT32_MAX)
634
#define MY_FILEPOS_ERROR -1
636
/* Defines for time function */
637
#define SCALE_SEC 100
638
#define SCALE_USEC 10000
640
#define DRIZZLE_SERVER
642
/* Length of decimal number represented by INT32. */
643
#define MY_INT32_NUM_DECIMAL_DIGITS 11
645
/* Length of decimal number represented by INT64. */
646
#define MY_INT64_NUM_DECIMAL_DIGITS 21
649
Io buffer size; Must be a power of 2 and
650
a multiple of 512. May be
651
smaller what the disk page size. This influences the speed of the
652
isam btree library. eg to big to slow.
655
/* Max file name len */
657
/* Max length of extension (part of FN_LEN) */
659
/* Max length of full path-name */
660
#define FN_REFLEN 512
661
/* File extension character */
662
#define FN_EXTCHAR '.'
663
/* ~ is used as abbrev for home dir */
664
#define FN_HOMELIB '~'
665
/* ./ is used as abbrev for current dir */
666
#define FN_CURLIB '.'
667
/* Parent directory; Must be a string */
668
#define FN_PARENTDIR ".."
670
/* Quote argument (before cpp) */
672
# define QUOTE_ARG(x) #x
674
/* Quote argument, (after cpp) */
675
#ifndef STRINGIFY_ARG
676
# define STRINGIFY_ARG(x) QUOTE_ARG(x)
680
* The macros below are borrowed from include/linux/compiler.h in the
681
* Linux kernel. Use them to indicate the likelyhood of the truthfulness
682
* of a condition. This serves two purposes - newer versions of gcc will be
683
* able to optimize for branch predication, which could yield siginficant
684
* performance gains in frequently executed sections of the code, and the
685
* other reason to use them is for documentation
687
#if !defined(__GNUC__)
688
#define __builtin_expect(x, expected_value) (x)
691
#define likely(x) __builtin_expect((x),1)
692
#define unlikely(x) __builtin_expect((x),0)
696
Only Linux is known to need an explicit sync of the directory to make sure a
697
file creation/deletion/renaming in(from,to) this directory durable.
699
#ifdef TARGET_OS_LINUX
700
#define NEED_EXPLICIT_SYNC_DIR 1
703
/* We need to turn off _DTRACE_VERSION if we're not going to use dtrace */
704
#if !defined(HAVE_DTRACE)
705
# undef _DTRACE_VERSION
706
# define _DTRACE_VERSION 0
709
#endif /* DRIZZLED_DEFINITIONS_H */
1106
#define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL)
1107
#define f_no_default(x) (x & FIELDFLAG_NO_DEFAULT)
1108
#define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE)
1110
#endif /* DRIZZLE_SERVER_DEFINITIONS_H */