82
90
#define RAND_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-1))
83
91
#define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \
85
#define MAX_FIELDS 4096 /* Historical limit from MySQL FRM. */
93
#define MAX_FIELDS 4096 /* Limit in the .frm file */
87
95
#define MAX_SELECT_NESTING (sizeof(nesting_map)*8-1)
89
97
#define MAX_SORT_MEMORY (2048*1024-MALLOC_OVERHEAD)
90
98
#define MIN_SORT_MEMORY (32*1024-MALLOC_OVERHEAD)
100
/* Memory allocated when parsing a statement / saving a statement */
101
#define MEM_ROOT_BLOCK_SIZE 8192
102
#define MEM_ROOT_PREALLOC 8192
103
#define TRANS_MEM_ROOT_BLOCK_SIZE 4096
104
#define TRANS_MEM_ROOT_PREALLOC 4096
92
106
#define DEFAULT_ERROR_COUNT 64
93
107
#define EXTRA_RECORDS 10 /* Extra records in sort */
108
#define SCROLL_EXTRA 5 /* Extra scroll-rows. */
109
#define FIELD_NAME_USED ((uint) 32768) /* Bit set if fieldname used */
110
#define FIELD_NR_MASK 16383 /* To get fieldnumber */
111
#define FERR -1 /* Error from my_functions */
112
#define CREATE_MODE 0 /* Default mode on new files */
94
113
#define NAMES_SEP_CHAR '\377' /* Char to sep. names */
96
#define READ_RECORD_BUFFER (uint32_t) (IO_SIZE*8) /* Pointer_buffer_size */
97
#define DISK_BUFFER_SIZE (uint32_t) (IO_SIZE*16) /* Size of diskbuffer */
115
#define READ_RECORD_BUFFER (uint) (IO_SIZE*8) /* Pointer_buffer_size */
116
#define DISK_BUFFER_SIZE (uint) (IO_SIZE*16) /* Size of diskbuffer */
118
#define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH)
99
119
#define ME_ERROR (ME_BELL+ME_OLDWIN+ME_NOREFRESH)
100
120
#define MYF_RW MYF(MY_WME+MY_NABP) /* Vid my_read & my_write */
123
#define store_record(A,B) memcpy((A)->B,(A)->record[0],(size_t) (A)->s->reclength)
124
#define restore_record(A,B) memcpy((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
125
#define cmp_record(A,B) memcmp((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
126
#define empty_record(A) \
128
restore_record((A),s->default_values); \
129
memset((A)->null_flags, 255, (A)->s->null_bytes); \
132
/* Defines for use with openfrm, openprt and openfrd */
134
#define READ_ALL 1 /* openfrm: Read all parameters */
135
#define CHANGE_FRM 2 /* openfrm: open .frm as O_RDWR */
136
#define EXTRA_RECORD 8 /* Reservera plats f|r extra record */
137
#define DONT_GIVE_ERROR 256 /* Don't do frm_error on openfrm */
138
#define DELAYED_OPEN 4096 /* Open table later */
140
This flag is used in function get_all_tables() which fills
141
I_S tables with data which are retrieved from frm files and storage engine
142
The flag means that we need to open FRM file only to get necessary data.
144
#define OPEN_FRM_FILE_ONLY 32768
146
This flag is used in function get_all_tables() which fills
147
I_S tables with data which are retrieved from frm files and storage engine
148
The flag means that we need to process tables only to get necessary data.
149
Views are not processed.
151
#define OPEN_TABLE_ONLY OPEN_FRM_FILE_ONLY*2
153
This flag is used in function get_all_tables() which fills
154
I_S tables with data which are retrieved from frm files and storage engine.
155
The flag means that I_S table uses optimization algorithm.
157
#define OPTIMIZE_I_S_TABLE OPEN_TABLE_ONLY*2
159
#define SC_INFO_LENGTH 4 /* Form format constant */
160
#define TE_INFO_LENGTH 3
161
#define MTYP_NOEMPTY_BIT 128
163
#define FRM_VER_TRUE_VARCHAR (FRM_VER+4) /* 10 */
164
#define DRIZZLE_VERSION_TABLESPACE_IN_FRM_CGE 50120
165
#define DRIZZLE_VERSION_TABLESPACE_IN_FRM 50205
166
#define DRIZZLE_VERSION_TABLESPACE_IN_FRM_STR "50205"
103
169
Minimum length pattern before Turbo Boyer-Moore is used
104
170
for SELECT "text" LIKE "%pattern%", excluding the two
191
285
/** Characters shown for the command in 'show processlist'. */
192
286
#define PROCESS_LIST_WIDTH 100
287
/* Characters shown for the command in 'information_schema.processlist' */
288
#define PROCESS_LIST_INFO_WIDTH 65535
194
290
#define PRECISION_FOR_DOUBLE 53
195
291
#define PRECISION_FOR_FLOAT 24
294
Default time to wait before aborting a new client connection
295
that does not respond to "initial server greeting" timely
297
#define CONNECT_TIMEOUT 10
197
299
/* The following can also be changed from the command line */
198
300
#define DEFAULT_CONCURRENCY 10
199
301
#define FLUSH_TIME 0 /**< Don't flush tables */
200
302
#define MAX_CONNECT_ERRORS 10 ///< errors before disabling host
202
/* Bits from testflag */
205
TEST_PRINT_CACHED_TABLES= 1,
208
TEST_KEEP_TMP_TABLES,
209
TEST_READCHECK, /**< Force use of readcheck */
211
TEST_CORE_ON_SIGNAL, /**< Give core if signal */
213
TEST_SIGINT, /**< Allow sigint on threads */
214
TEST_SYNCHRONIZATION /**< get server to do sleep in some places */
304
#define INTERRUPT_PRIOR 10
305
#define CONNECT_PRIOR 9
307
#define QUERY_PRIOR 6
309
/* Bits from testflag */
310
#define TEST_PRINT_CACHED_TABLES 1
311
#define TEST_NO_KEY_GROUP 2
312
#define TEST_MIT_THREAD 4
313
#define TEST_KEEP_TMP_TABLES 16
314
#define TEST_READCHECK 64 /**< Force use of readcheck */
315
#define TEST_NO_EXTRA 128
316
#define TEST_CORE_ON_SIGNAL 256 /**< Give core if signal */
317
#define TEST_NO_STACKTRACE 512
318
#define TEST_SIGINT 1024 /**< Allow sigint on threads */
319
#define TEST_SYNCHRONIZATION 2048 /**< get server to do sleep in some places */
217
321
/* Bits for different SQL modes modes (including ANSI mode) */
218
322
#define MODE_NO_ZERO_DATE (2)
219
323
#define MODE_INVALID_DATES (MODE_NO_ZERO_DATE*2)
325
/* @@optimizer_switch flags */
326
#define OPTIMIZER_SWITCH_NO_MATERIALIZATION 1
327
#define OPTIMIZER_SWITCH_NO_SEMIJOIN 2
221
329
#define MY_CHARSET_BIN_MB_MAXLEN 1
223
331
// uncachable cause
224
static const uint32_t UNCACHEABLE_DEPENDENT= 1;
225
static const uint32_t UNCACHEABLE_RAND= 2;
226
static const uint32_t UNCACHEABLE_SIDEEFFECT= 3;
332
#define UNCACHEABLE_DEPENDENT 1
333
#define UNCACHEABLE_RAND 2
334
#define UNCACHEABLE_SIDEEFFECT 4
227
335
/// forcing to save JOIN for explain
228
static const uint32_t UNCACHEABLE_EXPLAIN= 4;
336
#define UNCACHEABLE_EXPLAIN 8
229
337
/** Don't evaluate subqueries in prepare even if they're not correlated */
230
static const uint32_t UNCACHEABLE_PREPARE= 5;
338
#define UNCACHEABLE_PREPARE 16
231
339
/* For uncorrelated SELECT in an UNION with some correlated SELECTs */
232
static const uint32_t UNCACHEABLE_UNITED= 6;
340
#define UNCACHEABLE_UNITED 32
234
342
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
235
343
#define UNDEF_POS (-1)
345
/* BINLOG_DUMP options */
347
#define BINLOG_DUMP_NON_BLOCK 1
349
/* sql_show.cc:show_log_files() */
350
#define SHOW_LOG_STATUS_FREE "FREE"
351
#define SHOW_LOG_STATUS_INUSE "IN USE"
237
353
/* Options to add_table_to_list() */
238
static const uint32_t TL_OPTION_UPDATING= 0;
239
static const uint32_t TL_OPTION_FORCE_INDEX= 1;
240
static const uint32_t TL_OPTION_IGNORE_LEAVES= 2;
241
static const uint32_t TL_OPTION_ALIAS= 3;
242
static const uint32_t NUM_OF_TABLE_OPTIONS= 4;
354
#define TL_OPTION_UPDATING 1
355
#define TL_OPTION_FORCE_INDEX 2
356
#define TL_OPTION_IGNORE_LEAVES 4
357
#define TL_OPTION_ALIAS 8
244
359
/* Some portable defines */
272
511
#define HA_ADMIN_INTERNAL_ERROR -4
273
512
#define HA_ADMIN_INVALID -5
274
513
#define HA_ADMIN_REJECT -6
514
#define HA_ADMIN_TRY_ALTER -7
515
#define HA_ADMIN_WRONG_CHECKSUM -8
516
#define HA_ADMIN_NOT_BASE_TABLE -9
517
#define HA_ADMIN_NEEDS_UPGRADE -10
518
#define HA_ADMIN_NEEDS_ALTER -11
519
#define HA_ADMIN_NEEDS_CHECK -12
522
#define HA_ADD_INDEX (0)
523
#define HA_DROP_INDEX (1)
524
#define HA_ALTER_INDEX (2)
525
#define HA_RENAME_INDEX (3)
526
#define HA_ADD_UNIQUE_INDEX (4)
527
#define HA_DROP_UNIQUE_INDEX (5)
528
#define HA_ALTER_UNIQUE_INDEX (6)
529
#define HA_RENAME_UNIQUE_INDEX (7)
530
#define HA_ADD_PK_INDEX (8)
531
#define HA_DROP_PK_INDEX (9)
532
#define HA_ALTER_PK_INDEX (10)
533
#define HA_ADD_COLUMN (11)
534
#define HA_DROP_COLUMN (12)
535
#define HA_CHANGE_COLUMN (13)
536
#define HA_ALTER_COLUMN_NAME (14)
537
#define HA_ALTER_COLUMN_TYPE (15)
538
#define HA_ALTER_COLUMN_ORDER (16)
539
#define HA_ALTER_COLUMN_NULLABLE (17)
540
#define HA_COLUMN_DEFAULT_VALUE (18)
541
#define HA_COLUMN_STORAGE (19)
542
#define HA_COLUMN_FORMAT (20)
543
#define HA_ADD_FOREIGN_KEY (21)
544
#define HA_DROP_FOREIGN_KEY (22)
545
#define HA_ALTER_FOREIGN_KEY (23)
546
#define HA_ADD_CONSTRAINT (24)
547
#define HA_CHANGE_CHARACTER_SET (30)
548
#define HA_SET_DEFAULT_CHARACTER_SET (31)
549
#define HA_CHANGE_AUTOINCREMENT_VALUE (32)
550
#define HA_ALTER_STORAGE (33)
551
#define HA_ALTER_TABLESPACE (34)
552
#define HA_ALTER_ROW_FORMAT (35)
553
#define HA_RENAME_TABLE (36)
554
#define HA_ALTER_STORAGE_ENGINE (37)
555
#define HA_RECREATE (38)
556
#define HA_ALTER_STORED_VCOL (39)
557
/* Remember to increase HA_MAX_ALTER_FLAGS when adding more flags! */
559
/* Return values for check_if_supported_alter */
561
#define HA_ALTER_ERROR -1
562
#define HA_ALTER_SUPPORTED_WAIT_LOCK 0
563
#define HA_ALTER_SUPPORTED_NO_LOCK 1
564
#define HA_ALTER_NOT_SUPPORTED 2
566
/* Bits in table_flags() to show what database can do */
568
#define HA_NO_TRANSACTIONS (1 << 0) /* Doesn't support transactions */
569
#define HA_PARTIAL_COLUMN_READ (1 << 1) /* read may not return all columns */
570
#define HA_TABLE_SCAN_ON_INDEX (1 << 2) /* No separate data/index file */
572
The following should be set if the following is not true when scanning
573
a table with rnd_next()
574
- We will see all rows (including deleted ones)
575
- Row positions are 'table->s->db_record_offset' apart
576
If this flag is not set, filesort will do a postion() call for each matched
577
row to be able to find the row later.
579
#define HA_REC_NOT_IN_SEQ (1 << 3)
582
Reading keys in random order is as fast as reading keys in sort order
583
(Used in records.cc to decide if we should use a record cache and by
584
filesort to decide if we should sort key + data or key + pointer-to-row
586
#define HA_FAST_KEY_READ (1 << 5)
588
Set the following flag if we on delete should force all key to be read
589
and on update read all keys that changes
591
#define HA_REQUIRES_KEY_COLUMNS_FOR_DELETE (1 << 6)
592
#define HA_NULL_IN_KEY (1 << 7) /* One can have keys with NULL */
593
#define HA_DUPLICATE_POS (1 << 8) /* ha_position() gives dup row */
594
#define HA_NO_BLOBS (1 << 9) /* Doesn't support blobs */
595
#define HA_CAN_INDEX_BLOBS (1 << 10)
596
#define HA_AUTO_PART_KEY (1 << 11) /* auto-increment in multi-part key */
597
#define HA_REQUIRE_PRIMARY_KEY (1 << 12) /* .. and can't create a hidden one */
598
#define HA_STATS_RECORDS_IS_EXACT (1 << 13) /* stats.records is exact */
600
If we get the primary key columns for free when we do an index read
601
It also implies that we have to retrive the primary key when using
602
position() and rnd_pos().
604
#define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)
606
If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position()
607
uses a primary key. Without primary key, we can't call position().
609
#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1 << 16)
610
#define HA_NOT_DELETE_WITH_CACHE (1 << 18)
612
The following is we need to a primary key to delete (and update) a row.
613
If there is no primary key, all columns needs to be read on update and delete
615
#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE (1 << 19)
616
#define HA_NO_PREFIX_CHAR_KEYS (1 << 20)
617
#define HA_NO_AUTO_INCREMENT (1 << 23)
618
#define HA_HAS_CHECKSUM (1 << 24)
619
/* Table data are stored in separate files (for lower_case_table_names) */
620
#define HA_FILE_BASED (1 << 26)
621
#define HA_NEED_READ_RANGE_BUFFER (1 << 29) /* for read_multi_range */
622
#define HA_ANY_INDEX_MAY_BE_UNIQUE (1 << 30)
623
#define HA_NO_COPY_ON_ALTER (INT64_C(1) << 31)
624
#define HA_HAS_RECORDS (INT64_C(1) << 32) /* records() gives exact count*/
625
#define HA_MRR_CANT_SORT (INT64_C(1) << 34)
628
Engine is capable of row-format and statement-format logging,
631
#define HA_BINLOG_ROW_CAPABLE (INT64_C(1) << 35)
632
#define HA_BINLOG_STMT_CAPABLE (INT64_C(1) << 36)
634
#define HA_ONLINE_ALTER (INT64_C(1) << 37)
637
Set of all binlog flags. Currently only contain the capabilities
640
#define HA_BINLOG_FLAGS (HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE)
276
642
/* bits in index_flags(index_number) for what you can do with index */
277
643
#define HA_READ_NEXT 1 /* TODO really use this flag */
326
724
#define HA_KEY_NULL_LENGTH 1
327
725
#define HA_KEY_BLOB_LENGTH 2
727
#define HA_LEX_CREATE_TMP_TABLE 1
728
#define HA_LEX_CREATE_IF_NOT_EXISTS 2
729
#define HA_LEX_CREATE_TABLE_LIKE 4
730
#define HA_OPTION_NO_CHECKSUM (1L << 17)
731
#define HA_OPTION_NO_DELAY_KEY_WRITE (1L << 18)
329
732
#define HA_MAX_REC_LENGTH 65535
734
/* Table caching type */
735
#define HA_CACHE_TBL_NONTRANSACT 0
736
#define HA_CACHE_TBL_NOCACHE 1
737
#define HA_CACHE_TBL_ASKTRANSACT 2
738
#define HA_CACHE_TBL_TRANSACT 4
331
740
/* Options of START TRANSACTION statement (and later of SET TRANSACTION stmt) */
332
enum start_transaction_option_t
334
START_TRANS_NO_OPTIONS,
335
START_TRANS_OPT_WITH_CONS_SNAPSHOT
741
#define DRIZZLE_START_TRANS_OPT_WITH_CONS_SNAPSHOT 1
338
743
/* Flags for method is_fatal_error */
339
744
#define HA_CHECK_DUP_KEY 1
340
745
#define HA_CHECK_DUP_UNIQUE 2
341
746
#define HA_CHECK_DUP (HA_CHECK_DUP_KEY + HA_CHECK_DUP_UNIQUE)
751
DB_TYPE_FIRST_DYNAMIC=42,
752
DB_TYPE_DEFAULT=127 // Must be last
755
enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
756
ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED,
757
ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT, ROW_TYPE_PAGE };
759
enum column_format_type { COLUMN_FORMAT_TYPE_NOT_USED= -1,
760
COLUMN_FORMAT_TYPE_DEFAULT= 0,
761
COLUMN_FORMAT_TYPE_FIXED= 1,
762
COLUMN_FORMAT_TYPE_DYNAMIC= 2 };
764
enum enum_binlog_func {
769
BFN_BINLOG_PURGE_FILE= 5
772
enum enum_binlog_command {
782
/* struct to hold information about the table that should be created */
344
784
/* Bits in used_fields */
345
785
#define HA_CREATE_USED_AUTO (1L << 0)
787
#define HA_CREATE_USED_UNION (1L << 2)
788
#define HA_CREATE_USED_PASSWORD (1L << 17)
790
#define HA_CREATE_USED_INSERT_METHOD (1L << 3)
791
#define HA_CREATE_USED_MIN_ROWS (1L << 4)
792
#define HA_CREATE_USED_MAX_ROWS (1L << 5)
793
#define HA_CREATE_USED_AVG_ROW_LENGTH (1L << 6)
794
#define HA_CREATE_USED_PACK_KEYS (1L << 7)
346
795
#define HA_CREATE_USED_CHARSET (1L << 8)
347
796
#define HA_CREATE_USED_DEFAULT_CHARSET (1L << 9)
797
#define HA_CREATE_USED_DATADIR (1L << 10)
798
#define HA_CREATE_USED_INDEXDIR (1L << 11)
799
#define HA_CREATE_USED_ENGINE (1L << 12)
800
#define HA_CREATE_USED_CHECKSUM (1L << 13)
801
#define HA_CREATE_USED_DELAY_KEY_WRITE (1L << 14)
348
802
#define HA_CREATE_USED_ROW_FORMAT (1L << 15)
803
#define HA_CREATE_USED_COMMENT (1L << 16)
804
#define HA_CREATE_USED_CONNECTION (1L << 18)
805
#define HA_CREATE_USED_KEY_BLOCK_SIZE (1L << 19)
806
#define HA_CREATE_USED_PAGE_CHECKSUM (1L << 21)
807
#define HA_CREATE_USED_BLOCK_SIZE (1L << 22)
809
#define MAXGTRIDSIZE 64
810
#define MAXBQUALSIZE 64
812
#define COMPATIBLE_DATA_YES 0
813
#define COMPATIBLE_DATA_NO 1
815
#define UNDEF_NODEGROUP 65535
816
#define NOT_A_PARTITION_ID ((uint32_t)-1)
818
enum ha_choice { HA_CHOICE_UNDEF, HA_CHOICE_NO, HA_CHOICE_YES };
351
821
The below two are not used (and not handled) in this milestone of this WL
386
856
#define HA_MRR_USE_DEFAULT_IMPL 64
859
Used only as parameter to multi_range_read_info():
860
Flag set <=> the caller guarantees that the bounds of the scanned ranges
861
will not have NULL values.
863
#define HA_MRR_NO_NULL_ENDPOINTS 128
865
enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME };
867
enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED,
868
ISO_REPEATABLE_READ, ISO_SERIALIZABLE};
871
enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED};
389
#define MYF(v) (static_cast<drizzled::myf>(v))
874
#define MYF(v) (myf) (v)
877
When a command is added here, be sure it's also added in mysqld.cc
878
in "struct show_var_st status_vars[]= {" ...
880
If the command returns a result set or is not allowed in stored
881
functions or triggers, please also make sure that
882
sp_get_flags_for_command (sp_head.cc) returns proper flags for the
886
enum enum_sql_command {
887
SQLCOM_SELECT, SQLCOM_CREATE_TABLE, SQLCOM_CREATE_INDEX, SQLCOM_ALTER_TABLE,
888
SQLCOM_UPDATE, SQLCOM_INSERT, SQLCOM_INSERT_SELECT,
889
SQLCOM_DELETE, SQLCOM_TRUNCATE, SQLCOM_DROP_TABLE, SQLCOM_DROP_INDEX,
890
SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
891
SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_STATUS,
892
SQLCOM_SHOW_ENGINE_LOGS, SQLCOM_SHOW_ENGINE_STATUS, SQLCOM_SHOW_ENGINE_MUTEX,
893
SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT,
895
SQLCOM_SHOW_CREATE_DB,
896
SQLCOM_SHOW_TABLE_STATUS,
897
SQLCOM_LOAD,SQLCOM_SET_OPTION,SQLCOM_LOCK_TABLES,SQLCOM_UNLOCK_TABLES,
898
SQLCOM_CHANGE_DB, SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB,
899
SQLCOM_REPAIR, SQLCOM_REPLACE, SQLCOM_REPLACE_SELECT,
900
SQLCOM_OPTIMIZE, SQLCOM_CHECK,
901
SQLCOM_ASSIGN_TO_KEYCACHE,
902
SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_ANALYZE,
903
SQLCOM_ROLLBACK, SQLCOM_ROLLBACK_TO_SAVEPOINT,
904
SQLCOM_COMMIT, SQLCOM_SAVEPOINT, SQLCOM_RELEASE_SAVEPOINT,
905
SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP,
906
SQLCOM_BEGIN, SQLCOM_CHANGE_MASTER,
908
SQLCOM_RESET, SQLCOM_PURGE, SQLCOM_PURGE_BEFORE, SQLCOM_SHOW_BINLOGS,
909
SQLCOM_SHOW_OPEN_TABLES,
910
SQLCOM_DELETE_MULTI, SQLCOM_UPDATE_MULTI,
915
SQLCOM_BINLOG_BASE64_EVENT,
918
When a command is added here, be sure it's also added in mysqld.cc
919
in "struct show_var_st status_vars[]= {" ...
921
/* This should be the last !!! */
925
enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_UPDATE };
927
enum release_type { RELEASE_NORMAL, RELEASE_WAIT_FOR_DROP };
930
Make sure that the order of schema_tables and enum_schema_tables are the same.
933
enum enum_schema_tables
937
SCH_COLLATION_CHARACTER_SET_APPLICABILITY,
940
SCH_GLOBAL_VARIABLES,
941
SCH_KEY_COLUMN_USAGE,
945
SCH_REFERENTIAL_CONSTRAINTS,
948
SCH_SESSION_VARIABLES,
952
SCH_TABLE_CONSTRAINTS,
958
#define MY_I_S_MAYBE_NULL 1
959
#define MY_I_S_UNSIGNED 2
962
#define SKIP_OPEN_TABLE 0 // do not open table
963
#define OPEN_FRM_ONLY 1 // open FRM file only
964
#define OPEN_FULL_TABLE 2 // open FRM,MYD, MYI files
392
967
"Declared Type Collation"
410
985
#define MY_COLL_DISALLOW_NONE 4
411
986
#define MY_COLL_CMP_CONV 7
413
inline static void clear_timestamp_auto_bits(enum timestamp_auto_set_type &_target_,
414
const enum timestamp_auto_set_type _bits_)
416
_target_= (enum timestamp_auto_set_type)((int)(_target_) & ~_bits_);
990
This enum is used to report information about monotonicity of function
991
represented by Item* tree.
992
Monotonicity is defined only for Item* trees that represent table
993
partitioning expressions (i.e. have no subselects/user vars/PS parameters
994
etc etc). An Item* tree is assumed to have the same monotonicity properties
995
as its correspoinding function F:
997
[signed] int64_t F(field1, field2, ...) {
998
put values of field_i into table record buffer;
999
return item->val_int();
1003
At the moment function monotonicity is not well defined (and so may be
1004
incorrect) for Item trees with parameters/return types that are different
1005
from INT_RESULT, may be NULL, or are unsigned.
1006
It will be possible to address this issue once the related partitioning bugs
1007
(BUG#16002, BUG#15447, BUG#13436) are fixed.
1010
typedef enum monotonicity_info
1012
NON_MONOTONIC, /* none of the below holds */
1013
MONOTONIC_INCREASING, /* F() is unary and (x < y) => (F(x) <= F(y)) */
1014
MONOTONIC_STRICT_INCREASING /* F() is unary and (x < y) => (F(x) < F(y)) */
1015
} enum_monotonicity_info;
1019
NO_TMP_TABLE, NON_TRANSACTIONAL_TMP_TABLE, TRANSACTIONAL_TMP_TABLE,
1020
INTERNAL_TMP_TABLE, SYSTEM_TMP_TABLE, TMP_TABLE_FRM_FILE_ONLY
1024
Values in this enum are used to indicate how a tables TIMESTAMP field
1025
should be treated. It can be set to the current timestamp on insert or
1027
WARNING: The values are used for bit operations. If you change the
1028
enum, you must keep the bitwise relation of the values. For example:
1029
(int) TIMESTAMP_AUTO_SET_ON_BOTH must be equal to
1030
(int) TIMESTAMP_AUTO_SET_ON_INSERT | (int) TIMESTAMP_AUTO_SET_ON_UPDATE.
1031
We use an enum here so that the debugger can display the value names.
1033
enum timestamp_auto_set_type
1035
TIMESTAMP_NO_AUTO_SET= 0, TIMESTAMP_AUTO_SET_ON_INSERT= 1,
1036
TIMESTAMP_AUTO_SET_ON_UPDATE= 2, TIMESTAMP_AUTO_SET_ON_BOTH= 3
1038
#define clear_timestamp_auto_bits(_target_, _bits_) \
1039
(_target_)= (enum timestamp_auto_set_type)((int)(_target_) & ~(int)(_bits_))
1042
Category of table found in the table share.
1044
enum enum_table_category
1049
TABLE_UNKNOWN_CATEGORY=0,
1053
The table is visible only in the session.
1055
- FLUSH TABLES WITH READ LOCK
1056
- SET GLOBAL READ_ONLY = ON
1057
do not apply to this table.
1058
Note that LOCK Table t FOR READ/WRITE
1059
can be used on temporary tables.
1060
Temporary tables are not part of the table cache.
1062
TABLE_CATEGORY_TEMPORARY=1,
1066
These tables do honor:
1067
- LOCK Table t FOR READ/WRITE
1068
- FLUSH TABLES WITH READ LOCK
1069
- SET GLOBAL READ_ONLY = ON
1070
User tables are cached in the table cache.
1072
TABLE_CATEGORY_USER=2,
1075
Information schema tables.
1076
These tables are an interface provided by the system
1077
to inspect the system metadata.
1078
These tables do *not* honor:
1079
- LOCK Table t FOR READ/WRITE
1080
- FLUSH TABLES WITH READ LOCK
1081
- SET GLOBAL READ_ONLY = ON
1082
as there is no point in locking explicitely
1083
an INFORMATION_SCHEMA table.
1084
Nothing is directly written to information schema tables.
1085
Note that this value is not used currently,
1086
since information schema tables are not shared,
1087
but implemented as session specific temporary tables.
1090
TODO: Fixing the performance issues of I_S will lead
1091
to I_S tables in the table cache, which should use
1094
TABLE_CATEGORY_INFORMATION
1097
/* Information for one open table */
1098
enum index_hint_type
1106
enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
1107
enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON,
1108
DELAY_KEY_WRITE_ALL };
1109
enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT,
1110
SLAVE_EXEC_MODE_IDEMPOTENT,
1111
SLAVE_EXEC_MODE_LAST_BIT};
1112
enum enum_mark_columns
1113
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
1115
enum enum_filetype { FILETYPE_CSV, FILETYPE_XML };
1117
enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND,
1118
IGNORE_ERRORS, REPORT_EXCEPT_NON_UNIQUE,
1119
IGNORE_EXCEPT_NON_UNIQUE};
1121
enum enum_schema_table_state
1124
PROCESSED_BY_CREATE_SORT_INDEX,
1125
PROCESSED_BY_JOIN_EXEC
420
1129
* The following are for the interface with the .frm file
1132
#define FIELDFLAG_DECIMAL 1
1133
#define FIELDFLAG_BINARY 1 // Shares same flag
1134
#define FIELDFLAG_NUMBER 2
1135
#define FIELDFLAG_DECIMAL_POSITION 4
1136
#define FIELDFLAG_PACK 120 // Bits used for packing
1137
#define FIELDFLAG_INTERVAL 256 // mangled with decimals!
1138
#define FIELDFLAG_BLOB 1024 // mangled with decimals!
1140
#define FIELDFLAG_NO_DEFAULT 16384 /* sql */
1141
#define FIELDFLAG_SUM ((uint32_t) 32768)// predit: +#fieldflag
1142
#define FIELDFLAG_MAYBE_NULL ((uint32_t) 32768)// sql
1143
#define FIELDFLAG_HEX_ESCAPE ((uint32_t) 0x10000)
423
1144
#define FIELDFLAG_PACK_SHIFT 3
1145
#define FIELDFLAG_DEC_SHIFT 8
424
1146
#define FIELDFLAG_MAX_DEC 31
427
// FIXME: T will just be drizzled::Field::utype, but that would
428
// require including field.h. Moving the function elsewhere might be a
429
// better idea. Leaving it for restructuring.
430
template <typename T>
431
T MTYP_TYPENR(const T& type)
433
return static_cast<T>(type & 127);
436
1148
#define MTYP_TYPENR(type) (type & 127) /* Remove bits from type */
439
inline static uint32_t f_settype(const enum enum_field_types x)
441
return (uint32_t(x) << FIELDFLAG_PACK_SHIFT);
445
template <class T> void set_if_bigger(T &a, const T &b)
451
template <class T> void set_if_smaller(T &a, const T &b)
458
#define set_if_bigger(a,b) do { \
459
const typeof(a) _a = (a); \
460
const typeof(b) _b = (b); \
461
(void) (&_a == &_b); \
462
if ((a) < (b)) (a)=(b); \
464
#define set_if_smaller(a,b) do { \
465
const typeof(a) _a = (a); \
466
const typeof(b) _b = (b); \
467
(void) (&_a == &_b); \
468
if ((a) > (b)) (a)=(b); \
472
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
473
#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
478
#define array_elements(a) \
479
((sizeof(a) / sizeof(*(a))) / \
480
static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
483
/* Some types that is different between systems */
486
#define FN_LIBCHAR '/'
487
#define FN_ROOTDIR "/"
489
#define MY_NFILE 64 /* This is only used to save filenames */
490
#ifndef OS_FILE_LIMIT
491
#define OS_FILE_LIMIT 65535
495
How much overhead does malloc have. The code often allocates
496
something like 1024-MALLOC_OVERHEAD bytes
498
#define MALLOC_OVERHEAD 8
500
/* get memory in huncs */
501
static const uint32_t ONCE_ALLOC_INIT= 4096;
502
/* Typical record cash */
503
static const uint32_t RECORD_CACHE_SIZE= 64*1024;
506
/* Some things that this system doesn't have */
508
/* Some defines of functions for portability */
510
#ifndef uint64_t2double
511
#define uint64_t2double(A) ((double) (uint64_t) (A))
515
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
517
#define ulong_to_double(X) ((double) (ulong) (X))
519
/* From limits.h instead */
521
#define DBL_MIN 4.94065645841246544e-324
524
#define DBL_MAX 1.79769313486231470e+308
528
/* Define missing math constants. */
530
#define M_PI 3.14159265358979323846
533
#define M_E 2.7182818284590452354
536
#define M_LN2 0.69314718055994530942
540
Max size that must be added to a so that we know Size to make
543
#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1))
544
#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double))
545
/* Size to make adressable obj. */
546
#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t)))
547
/* Offset of field f in structure t */
548
#define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f)
550
#define ADD_TO_PTR(ptr,size,type) (type) (reinterpret_cast<const unsigned char*>(ptr)+size)
551
#define PTR_BYTE_DIFF(A,B) (ptrdiff_t) (reinterpret_cast<const unsigned char*>(A) - reinterpret_cast<const unsigned char*>(B))
553
#define ADD_TO_PTR(ptr,size,type) (type) ((unsigned char*) (ptr)+size)
554
#define PTR_BYTE_DIFF(A,B) (ptrdiff_t) ((unsigned char*) (A) - (unsigned char*) (B))
557
#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B))
558
#define MY_ALIGNED_BYTE_ARRAY(N, S, T) T N[MY_DIV_UP(S, sizeof(T))]
560
/* Typdefs for easyier portability */
563
#if defined(SIZEOF_OFF_T)
564
# if (SIZEOF_OFF_T == 8)
565
# define OFF_T_MAX (INT64_MAX)
567
# define OFF_T_MAX (INT32_MAX)
571
#define MY_FILEPOS_ERROR -1
573
#define DRIZZLE_SERVER
575
/* Length of decimal number represented by INT32. */
576
#define MY_INT32_NUM_DECIMAL_DIGITS 11
578
/* Length of decimal number represented by INT64. */
579
#define MY_INT64_NUM_DECIMAL_DIGITS 21
582
Io buffer size; Must be a power of 2 and
583
a multiple of 512. May be
584
smaller what the disk page size. This influences the speed of the
585
isam btree library. eg to big to slow.
588
/* Max file name len */
590
/* Max length of extension (part of FN_LEN) */
592
/* Max length of full path-name */
593
#define FN_REFLEN 512
594
/* File extension character */
595
#define FN_EXTCHAR '.'
596
/* ~ is used as abbrev for home dir */
597
#define FN_HOMELIB '~'
598
/* ./ is used as abbrev for current dir */
599
#define FN_CURLIB '.'
600
/* Parent directory; Must be a string */
601
#define FN_PARENTDIR ".."
603
/* Quote argument (before cpp) */
605
# define QUOTE_ARG(x) #x
607
/* Quote argument, (after cpp) */
608
#ifndef STRINGIFY_ARG
609
# define STRINGIFY_ARG(x) QUOTE_ARG(x)
613
* The macros below are borrowed from include/linux/compiler.h in the
614
* Linux kernel. Use them to indicate the likelyhood of the truthfulness
615
* of a condition. This serves two purposes - newer versions of gcc will be
616
* able to optimize for branch predication, which could yield siginficant
617
* performance gains in frequently executed sections of the code, and the
618
* other reason to use them is for documentation
620
#if !defined(__GNUC__)
621
#define __builtin_expect(x, expected_value) (x)
624
#define likely(x) __builtin_expect((x),1)
625
#define unlikely(x) __builtin_expect((x),0)
629
Only Linux is known to need an explicit sync of the directory to make sure a
630
file creation/deletion/renaming in(from,to) this directory durable.
632
#ifdef TARGET_OS_LINUX
633
#define NEED_EXPLICIT_SYNC_DIR 1
636
/* We need to turn off _DTRACE_VERSION if we're not going to use dtrace */
637
#if !defined(HAVE_DTRACE)
638
# undef _DTRACE_VERSION
639
# define _DTRACE_VERSION 0
642
typedef uint64_t table_map; /* Used for table bits in join */
643
typedef uint32_t nesting_map; /* Used for flags of nesting constructs */
645
} /* namespace drizzled */
647
#endif /* DRIZZLED_DEFINITIONS_H */
1150
#define f_is_dec(x) ((x) & FIELDFLAG_DECIMAL)
1151
#define f_is_num(x) ((x) & FIELDFLAG_NUMBER)
1152
#define f_is_decimal_precision(x) ((x) & FIELDFLAG_DECIMAL_POSITION)
1153
#define f_is_packed(x) ((x) & FIELDFLAG_PACK)
1154
#define f_packtype(x) (((x) >> FIELDFLAG_PACK_SHIFT) & 15)
1155
#define f_decimals(x) ((uint8_t) (((x) >> FIELDFLAG_DEC_SHIFT) & \
1157
#define f_is_alpha(x) (!f_is_num(x))
1158
#define f_is_binary(x) ((x) & FIELDFLAG_BINARY) // 4.0- compatibility
1159
#define f_is_enum(x) (((x) & (FIELDFLAG_INTERVAL | FIELDFLAG_NUMBER)) == \
1161
#define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == \
1163
#define f_is_equ(x) ((x) & (1+2+FIELDFLAG_PACK+31*256))
1164
#define f_settype(x) (((int) x) << FIELDFLAG_PACK_SHIFT)
1165
#define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL)
1166
#define f_no_default(x) (x & FIELDFLAG_NO_DEFAULT)
1167
#define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE)
1169
#endif /* DRIZZLE_SERVER_DEFINITIONS_H */