31
31
#include <stdint.h>
38
/* Global value for how we extend our temporary directory */
39
#define GLOBAL_TEMPORARY_EXT ".temporary"
41
33
/* These paths are converted to other systems (WIN95) before use */
43
35
#define LANGUAGE "english/"
44
36
#define TEMP_PREFIX "MY"
45
37
#define LOG_PREFIX "ML"
47
#define ER(X) ::drizzled::error_message((X))
49
/* buffer size for strerror_r() */
50
#define STRERROR_MAX 256
38
#define PROGDIR "bin/"
40
#define ER(X) error_message((X))
42
#define LIBLEN FN_REFLEN-FN_LEN /* Max l{ngd p} dev */
52
43
/* extra 4+4 bytes for slave tmp tables */
53
44
#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4)
54
45
#define MAX_ALIAS_NAME 256
82
73
#define RAND_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-1))
83
74
#define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \
85
#define MAX_FIELDS 4096 /* Historical limit from MySQL FRM. */
76
#define MAX_FIELDS 4096 /* Limit in the .frm file */
87
78
#define MAX_SELECT_NESTING (sizeof(nesting_map)*8-1)
89
80
#define MAX_SORT_MEMORY (2048*1024-MALLOC_OVERHEAD)
90
81
#define MIN_SORT_MEMORY (32*1024-MALLOC_OVERHEAD)
83
/* Memory allocated when parsing a statement / saving a statement */
84
#define MEM_ROOT_BLOCK_SIZE 8192
85
#define MEM_ROOT_PREALLOC 8192
92
87
#define DEFAULT_ERROR_COUNT 64
93
88
#define EXTRA_RECORDS 10 /* Extra records in sort */
89
#define SCROLL_EXTRA 5 /* Extra scroll-rows. */
90
#define FIELD_NAME_USED ((uint32_t) 32768) /* Bit set if fieldname used */
91
#define FIELD_NR_MASK 16383 /* To get fieldnumber */
92
#define FERR -1 /* Error from my_functions */
93
#define CREATE_MODE 0 /* Default mode on new files */
94
94
#define NAMES_SEP_CHAR '\377' /* Char to sep. names */
96
96
#define READ_RECORD_BUFFER (uint32_t) (IO_SIZE*8) /* Pointer_buffer_size */
97
97
#define DISK_BUFFER_SIZE (uint32_t) (IO_SIZE*16) /* Size of diskbuffer */
99
#define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH)
99
100
#define ME_ERROR (ME_BELL+ME_OLDWIN+ME_NOREFRESH)
100
101
#define MYF_RW MYF(MY_WME+MY_NABP) /* Vid my_read & my_write */
103
/* Defines for use with openfrm, openprt and openfrd */
105
#define READ_ALL 1 /* openfrm: Read all parameters */
106
#define EXTRA_RECORD 8 /* Reservera plats f|r extra record */
107
#define DONT_GIVE_ERROR 256 /* Don't do frm_error on openfrm */
108
#define DELAYED_OPEN 4096 /* Open table later */
110
This flag is used in function get_all_tables() which fills
111
I_S tables with data which are retrieved from frm files and storage engine
112
The flag means that we need to open FRM file only to get necessary data.
114
#define OPEN_FRM_FILE_ONLY 32768
116
This flag is used in function get_all_tables() which fills
117
I_S tables with data which are retrieved from frm files and storage engine
118
The flag means that we need to process tables only to get necessary data.
119
Views are not processed.
121
#define OPEN_TABLE_ONLY OPEN_FRM_FILE_ONLY*2
123
This flag is used in function get_all_tables() which fills
124
I_S tables with data which are retrieved from frm files and storage engine.
125
The flag means that I_S table uses optimization algorithm.
127
#define OPTIMIZE_I_S_TABLE OPEN_TABLE_ONLY*2
103
130
Minimum length pattern before Turbo Boyer-Moore is used
104
131
for SELECT "text" LIKE "%pattern%", excluding the two
137
167
#define STACK_MIN_SIZE_FOR_OPEN 1024*80
138
168
#define STACK_BUFF_ALLOC 352 ///< For stack overrun checks
170
#define TEMP_POOL_SIZE 128
140
172
#define QUERY_ALLOC_BLOCK_SIZE 8192
141
173
#define QUERY_ALLOC_PREALLOC_SIZE 8192
174
#define TRANS_ALLOC_BLOCK_SIZE 4096
175
#define TRANS_ALLOC_PREALLOC_SIZE 4096
142
176
#define RANGE_ALLOC_BLOCK_SIZE 4096
143
177
#define TABLE_ALLOC_BLOCK_SIZE 1024
144
178
#define WARN_ALLOC_BLOCK_SIZE 2048
191
226
/** Characters shown for the command in 'show processlist'. */
192
227
#define PROCESS_LIST_WIDTH 100
228
/* Characters shown for the command in 'information_schema.processlist' */
229
#define PROCESS_LIST_INFO_WIDTH 65535
194
231
#define PRECISION_FOR_DOUBLE 53
195
232
#define PRECISION_FOR_FLOAT 24
218
260
#define MODE_NO_ZERO_DATE (2)
219
261
#define MODE_INVALID_DATES (MODE_NO_ZERO_DATE*2)
263
/* @@optimizer_switch flags */
264
#define OPTIMIZER_SWITCH_NO_MATERIALIZATION 1
265
#define OPTIMIZER_SWITCH_NO_SEMIJOIN 2
221
267
#define MY_CHARSET_BIN_MB_MAXLEN 1
223
269
// 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;
270
#define UNCACHEABLE_DEPENDENT 1
271
#define UNCACHEABLE_RAND 2
272
#define UNCACHEABLE_SIDEEFFECT 4
227
273
/// forcing to save JOIN for explain
228
static const uint32_t UNCACHEABLE_EXPLAIN= 4;
274
#define UNCACHEABLE_EXPLAIN 8
229
275
/** Don't evaluate subqueries in prepare even if they're not correlated */
230
static const uint32_t UNCACHEABLE_PREPARE= 5;
276
#define UNCACHEABLE_PREPARE 16
231
277
/* For uncorrelated SELECT in an UNION with some correlated SELECTs */
232
static const uint32_t UNCACHEABLE_UNITED= 6;
278
#define UNCACHEABLE_UNITED 32
234
280
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
235
281
#define UNDEF_POS (-1)
283
/* sql_show.cc:show_log_files() */
284
#define SHOW_LOG_STATUS_FREE "FREE"
285
#define SHOW_LOG_STATUS_INUSE "IN USE"
237
287
/* 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;
288
#define TL_OPTION_UPDATING 1
289
#define TL_OPTION_FORCE_INDEX 2
290
#define TL_OPTION_IGNORE_LEAVES 4
291
#define TL_OPTION_ALIAS 8
244
293
/* Some portable defines */
260
309
#define STRING_BUFFER_USUAL_SIZE 80
312
Some defines for exit codes for ::is_equal class functions.
314
#define IS_EQUAL_NO 0
315
#define IS_EQUAL_YES 1
316
#define IS_EQUAL_PACK_LENGTH 2
262
319
typedef void *range_seq_t;
264
321
enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX };
273
330
#define HA_ADMIN_INVALID -5
274
331
#define HA_ADMIN_REJECT -6
333
#define HA_NOT_DELETE_WITH_CACHE (1 << 18)
276
335
/* bits in index_flags(index_number) for what you can do with index */
277
336
#define HA_READ_NEXT 1 /* TODO really use this flag */
278
337
#define HA_READ_PREV 2 /* supports ::index_prev */
346
406
#define HA_CREATE_USED_CHARSET (1L << 8)
347
407
#define HA_CREATE_USED_DEFAULT_CHARSET (1L << 9)
348
408
#define HA_CREATE_USED_ROW_FORMAT (1L << 15)
409
#define HA_CREATE_USED_KEY_BLOCK_SIZE (1L << 19)
410
#define HA_CREATE_USED_BLOCK_SIZE (1L << 22)
412
#define MAXGTRIDSIZE 64
413
#define MAXBQUALSIZE 64
351
416
The below two are not used (and not handled) in this milestone of this WL
409
478
#define MY_COLL_ALLOW_CONV 3
410
479
#define MY_COLL_DISALLOW_NONE 4
411
480
#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_);
481
#define clear_timestamp_auto_bits(_target_, _bits_) \
482
(_target_)= (enum timestamp_auto_set_type)((int)(_target_) & ~(int)(_bits_))
420
485
* The following are for the interface with the .frm file
423
488
#define FIELDFLAG_PACK_SHIFT 3
424
489
#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
491
#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);
493
#define f_packtype(x) (((x) >> FIELDFLAG_PACK_SHIFT) & 15)
494
#define f_settype(x) (((int) x) << FIELDFLAG_PACK_SHIFT)
444
497
#ifdef __cplusplus
445
498
template <class T> void set_if_bigger(T &a, const T &b)
501
554
static const uint32_t ONCE_ALLOC_INIT= 4096;
502
555
/* Typical record cash */
503
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;
506
564
/* Some things that this system doesn't have */
508
566
/* Some defines of functions for portability */
568
#undef remove /* Crashes MySQL on SCO 5.0.0 */
510
569
#ifndef uint64_t2double
511
570
#define uint64_t2double(A) ((double) (uint64_t) (A))