1
/* Copyright (C) 2000-2006 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
20
* Mostly constants and some macros/functions used by the server
23
#ifndef DRIZZLE_SERVER_DEFINITIONS_H
24
#define DRIZZLE_SERVER_DEFINITIONS_H
27
#define NO_ALARM_LOOP /* lib5 and popen can't use alarm */
30
/* These paths are converted to other systems (WIN95) before use */
32
#define LANGUAGE "english/"
33
#define ERRMSG_FILE "errmsg.sys"
34
#define TEMP_PREFIX "MY"
35
#define LOG_PREFIX "ML"
36
#define PROGDIR "bin/"
38
#define DATADIR "data/"
41
#define SHAREDIR "share/"
44
#define PLUGINDIR "lib/plugin"
47
#define ER(X) _(drizzled_error_messages[(X) - ER_ERROR_FIRST])
48
#define ER_SAFE(X) (((X) >= ER_ERROR_FIRST && (X) <= ER_ERROR_LAST) ? ER(X) : _("Invalid error code"))
50
#define ERRMAPP 1 /* Errormap f|r my_error */
51
#define LIBLEN FN_REFLEN-FN_LEN /* Max l{ngd p} dev */
52
/* extra 4+4 bytes for slave tmp tables */
53
#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4)
54
#define MAX_ALIAS_NAME 256
55
#define MAX_FIELD_NAME 34 /* Max colum name length +2 */
56
#define MAX_SYS_VAR_LENGTH 32
57
#define MAX_KEY MAX_INDEXES /* Max used keys */
58
#define MAX_REF_PARTS 16 /* Max parts used as ref */
59
#define MAX_KEY_LENGTH 4096 /* max possible key */
60
#define MAX_KEY_LENGTH_DECIMAL_WIDTH 4 /* strlen("4096") */
62
#define MAX_REFLENGTH 8 /* Max length for record ref */
64
#define MAX_REFLENGTH 4 /* Max length for record ref */
66
#define MAX_HOSTNAME 61 /* len+1 in mysql.user */
68
#define MAX_MBWIDTH 4 /* Max multibyte sequence */
69
#define MAX_FIELD_CHARLENGTH 255
70
#define MAX_FIELD_VARCHARLENGTH 65535
71
#define CONVERT_IF_BIGGER_TO_BLOB 512 /* Used for CREATE ... SELECT */
73
/* Max column width +1 */
74
#define MAX_FIELD_WIDTH (MAX_FIELD_CHARLENGTH*MAX_MBWIDTH+1)
76
#define MAX_BIT_FIELD_LENGTH 64 /* Max length in bits for bit fields */
78
#define MAX_DATE_WIDTH 10 /* YYYY-MM-DD */
79
#define MAX_TIME_WIDTH 23 /* -DDDDDD HH:MM:SS.###### */
80
#define MAX_DATETIME_FULL_WIDTH 29 /* YYYY-MM-DD HH:MM:SS.###### AM */
81
#define MAX_DATETIME_WIDTH 19 /* YYYY-MM-DD HH:MM:SS */
82
#define MAX_DATETIME_COMPRESSED_WIDTH 14 /* YYYYMMDDHHMMSS */
84
#define MAX_TABLES (sizeof(table_map)*8-3) /* Max tables in join */
85
#define PARAM_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-3))
86
#define OUTER_REF_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-2))
87
#define RAND_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-1))
88
#define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \
90
#define MAX_FIELDS 4096 /* Limit in the .frm file */
92
#define MAX_SELECT_NESTING (sizeof(nesting_map)*8-1)
94
#define MAX_SORT_MEMORY (2048*1024-MALLOC_OVERHEAD)
95
#define MIN_SORT_MEMORY (32*1024-MALLOC_OVERHEAD)
97
/* Memory allocated when parsing a statement / saving a statement */
98
#define MEM_ROOT_BLOCK_SIZE 8192
99
#define MEM_ROOT_PREALLOC 8192
100
#define TRANS_MEM_ROOT_BLOCK_SIZE 4096
101
#define TRANS_MEM_ROOT_PREALLOC 4096
103
#define DEFAULT_ERROR_COUNT 64
104
#define EXTRA_RECORDS 10 /* Extra records in sort */
105
#define SCROLL_EXTRA 5 /* Extra scroll-rows. */
106
#define FIELD_NAME_USED ((uint) 32768) /* Bit set if fieldname used */
107
#define FORM_NAME_USED ((uint) 16384) /* Bit set if formname used */
108
#define FIELD_NR_MASK 16383 /* To get fieldnumber */
109
#define FERR -1 /* Error from my_functions */
110
#define CREATE_MODE 0 /* Default mode on new files */
111
#define NAMES_SEP_CHAR '\377' /* Char to sep. names */
113
#define READ_RECORD_BUFFER (uint) (IO_SIZE*8) /* Pointer_buffer_size */
114
#define DISK_BUFFER_SIZE (uint) (IO_SIZE*16) /* Size of diskbuffer */
116
#define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH)
117
#define ME_ERROR (ME_BELL+ME_OLDWIN+ME_NOREFRESH)
118
#define MYF_RW MYF(MY_WME+MY_NABP) /* Vid my_read & my_write */
120
#define SPECIAL_USE_LOCKS 1 /* Lock used databases */
121
#define SPECIAL_NO_NEW_FUNC 2 /* Skip new functions */
122
#define SPECIAL_SKIP_SHOW_DB 4 /* Don't allow 'show db' */
123
#define SPECIAL_WAIT_IF_LOCKED 8 /* Wait if locked database */
124
#define SPECIAL_SAME_DB_NAME 16 /* form name = file name */
125
#define SPECIAL_ENGLISH 32 /* English error messages */
126
#define SPECIAL_NO_RESOLVE 64 /* Don't use gethostname */
127
#define SPECIAL_NO_PRIOR 128 /* Don't prioritize threads */
128
#define SPECIAL_BIG_SELECTS 256 /* Don't use heap tables */
129
#define SPECIAL_NO_HOST_CACHE 512 /* Don't cache hosts */
130
#define SPECIAL_SHORT_LOG_FORMAT 1024
131
#define SPECIAL_SAFE_MODE 2048
132
#define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Obsolete */
135
#define store_record(A,B) memcpy((A)->B,(A)->record[0],(size_t) (A)->s->reclength)
136
#define restore_record(A,B) memcpy((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
137
#define cmp_record(A,B) memcmp((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
138
#define empty_record(A) \
140
restore_record((A),s->default_values); \
141
memset((A)->null_flags, 255, (A)->s->null_bytes); \
144
/* Defines for use with openfrm, openprt and openfrd */
146
#define READ_ALL 1 /* openfrm: Read all parameters */
147
#define CHANGE_FRM 2 /* openfrm: open .frm as O_RDWR */
148
#define READ_KEYINFO 4 /* L{s nyckeldata fr}n filen */
149
#define EXTRA_RECORD 8 /* Reservera plats f|r extra record */
150
#define DONT_OPEN_TABLES 8 /* Don't open database-files (frd) */
151
#define DONT_OPEN_MASTER_REG 16 /* Don't open first reg-file (prt) */
152
#define EXTRA_LONG_RECORD 16 /* Plats f|r dubbel s|k-record */
153
#define COMPUTE_TYPES 32 /* Kontrollera type f|r f{ltena */
154
#define SEARCH_PRG 64 /* S|k efter registret i 'prg_dev' */
155
#define READ_USED_NAMES 128 /* L{s anv{nda formul{rnamn */
156
#define DONT_GIVE_ERROR 256 /* Don't do frm_error on openfrm */
157
#define READ_SCREENS 1024 /* Read screens, info and helpfile */
158
#define DELAYED_OPEN 4096 /* Open table later */
159
#define OPEN_VIEW 8192 /* Allow open on view */
160
#define OPEN_VIEW_NO_PARSE 16384 /* Open frm only if it's a view,
161
but do not parse view itself */
163
This flag is used in function get_all_tables() which fills
164
I_S tables with data which are retrieved from frm files and storage engine
165
The flag means that we need to open FRM file only to get necessary data.
167
#define OPEN_FRM_FILE_ONLY 32768
169
This flag is used in function get_all_tables() which fills
170
I_S tables with data which are retrieved from frm files and storage engine
171
The flag means that we need to process tables only to get necessary data.
172
Views are not processed.
174
#define OPEN_TABLE_ONLY OPEN_FRM_FILE_ONLY*2
176
This flag is used in function get_all_tables() which fills
177
I_S tables with data which are retrieved from frm files and storage engine
178
The flag means that we need to process views only to get necessary data.
179
Tables are not processed.
181
#define OPEN_VIEW_ONLY OPEN_TABLE_ONLY*2
183
This flag is used in function get_all_tables() which fills
184
I_S tables with data which are retrieved from frm files and storage engine.
185
The flag means that we need to open a view using
186
open_normal_and_derived_tables() function.
188
#define OPEN_VIEW_FULL OPEN_VIEW_ONLY*2
190
This flag is used in function get_all_tables() which fills
191
I_S tables with data which are retrieved from frm files and storage engine.
192
The flag means that I_S table uses optimization algorithm.
194
#define OPTIMIZE_I_S_TABLE OPEN_VIEW_FULL*2
196
#define SC_INFO_LENGTH 4 /* Form format constant */
197
#define TE_INFO_LENGTH 3
198
#define MTYP_NOEMPTY_BIT 128
200
#define FRM_VER_TRUE_VARCHAR (FRM_VER+4) /* 10 */
201
#define MYSQL_VERSION_TABLESPACE_IN_FRM_CGE 50120
202
#define MYSQL_VERSION_TABLESPACE_IN_FRM 50205
203
#define MYSQL_VERSION_TABLESPACE_IN_FRM_STR "50205"
206
Minimum length pattern before Turbo Boyer-Moore is used
207
for SELECT "text" LIKE "%pattern%", excluding the two
208
wildcards in class Item_func_like.
210
#define MIN_TURBOBM_PATTERN_LEN 3
213
Defines for binary logging.
214
Do not decrease the value of BIN_LOG_HEADER_SIZE.
215
Do not even increase it before checking code.
218
#define BIN_LOG_HEADER_SIZE 4
220
#define DEFAULT_KEY_CACHE_NAME "default"
222
#define STORAGE_TYPE_MASK 7
223
#define COLUMN_FORMAT_MASK 7
224
#define COLUMN_FORMAT_SHIFT 3
226
/* Below are #defines that used to be in mysql_priv.h */
227
/***************************************************************************
228
Configuration parameters
229
****************************************************************************/
230
#define ACL_CACHE_SIZE 256
231
#define MAX_PASSWORD_LENGTH 32
232
#define HOST_CACHE_SIZE 128
233
#define MAX_ACCEPT_RETRY 10 // Test accept this many times
234
#define MAX_FIELDS_BEFORE_HASH 32
235
#define USER_VARS_HASH_SIZE 16
236
#define TABLE_OPEN_CACHE_MIN 64
237
#define TABLE_OPEN_CACHE_DEFAULT 64
240
Value of 9236 discovered through binary search 2006-09-26 on Ubuntu Dapper
241
Drake, libc6 2.3.6-0ubuntu2, Linux kernel 2.6.15-27-686, on x86. (Added
242
100 bytes as reasonable buffer against growth and other environments'
245
Feel free to raise this by the smallest amount you can to get the
246
"execution_constants" test to pass.
248
#define STACK_MIN_SIZE 12000 ///< Abort if less stack during eval.
250
#define STACK_MIN_SIZE_FOR_OPEN 1024*80
251
#define STACK_BUFF_ALLOC 352 ///< For stack overrun checks
254
* @TODO Move into a drizzled.h since it's only used in drizzled.cc
256
* @TODO Rename to DRIZZLED_NET_RETRY_COUNT
258
#ifndef MYSQLD_NET_RETRY_COUNT
259
#define MYSQLD_NET_RETRY_COUNT 10 ///< Abort read after this many int.
261
#define TEMP_POOL_SIZE 128
263
#define QUERY_ALLOC_BLOCK_SIZE 8192
264
#define QUERY_ALLOC_PREALLOC_SIZE 8192
265
#define TRANS_ALLOC_BLOCK_SIZE 4096
266
#define TRANS_ALLOC_PREALLOC_SIZE 4096
267
#define RANGE_ALLOC_BLOCK_SIZE 4096
268
#define ACL_ALLOC_BLOCK_SIZE 1024
269
#define UDF_ALLOC_BLOCK_SIZE 1024
270
#define TABLE_ALLOC_BLOCK_SIZE 1024
271
#define BDB_LOG_ALLOC_BLOCK_SIZE 1024
272
#define WARN_ALLOC_BLOCK_SIZE 2048
273
#define WARN_ALLOC_PREALLOC_SIZE 1024
274
#define PROFILE_ALLOC_BLOCK_SIZE 2048
275
#define PROFILE_ALLOC_PREALLOC_SIZE 1024
278
The following parameters is to decide when to use an extra cache to
279
optimise seeks when reading a big table in sorted order
281
#define MIN_FILE_LENGTH_TO_USE_ROW_CACHE (10L*1024*1024)
282
#define MIN_ROWS_TO_USE_TABLE_CACHE 100
283
#define MIN_ROWS_TO_USE_BULK_INSERT 100
286
The following is used to decide if MySQL should use table scanning
287
instead of reading with keys. The number says how many evaluation of the
288
WHERE clause is comparable to reading one extra row from a table.
290
#define TIME_FOR_COMPARE 5 // 5 compares == one read
293
Number of comparisons of table rowids equivalent to reading one row from a
296
#define TIME_FOR_COMPARE_ROWID (TIME_FOR_COMPARE*2)
299
For sequential disk seeks the cost formula is:
300
DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST * #blocks_to_skip
302
The cost of average seek
303
DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST*BLOCKS_IN_AVG_SEEK =1.0.
305
#define DISK_SEEK_BASE_COST ((double)0.9)
307
#define BLOCKS_IN_AVG_SEEK 128
309
#define DISK_SEEK_PROP_COST ((double)0.1/BLOCKS_IN_AVG_SEEK)
313
Number of rows in a reference table when refereed through a not unique key.
314
This value is only used when we don't know anything about the key
317
#define MATCHING_ROWS_IN_OTHER_TABLE 10
319
/** Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used). */
320
#define KEY_DEFAULT_PACK_LENGTH 8
322
/** Characters shown for the command in 'show processlist'. */
323
#define PROCESS_LIST_WIDTH 100
324
/* Characters shown for the command in 'information_schema.processlist' */
325
#define PROCESS_LIST_INFO_WIDTH 65535
327
#define PRECISION_FOR_DOUBLE 53
328
#define PRECISION_FOR_FLOAT 24
331
Default time to wait before aborting a new client connection
332
that does not respond to "initial server greeting" timely
334
#define CONNECT_TIMEOUT 10
336
/* The following can also be changed from the command line */
337
#define DEFAULT_CONCURRENCY 10
338
#define FLUSH_TIME 0 /**< Don't flush tables */
339
#define MAX_CONNECT_ERRORS 10 ///< errors before disabling host
341
#define INTERRUPT_PRIOR 10
342
#define CONNECT_PRIOR 9
344
#define QUERY_PRIOR 6
346
/* Bits from testflag */
347
#define TEST_PRINT_CACHED_TABLES 1
348
#define TEST_NO_KEY_GROUP 2
349
#define TEST_MIT_THREAD 4
350
#define TEST_BLOCKING 8
351
#define TEST_KEEP_TMP_TABLES 16
352
#define TEST_READCHECK 64 /**< Force use of readcheck */
353
#define TEST_NO_EXTRA 128
354
#define TEST_CORE_ON_SIGNAL 256 /**< Give core if signal */
355
#define TEST_NO_STACKTRACE 512
356
#define TEST_SIGINT 1024 /**< Allow sigint on threads */
357
#define TEST_SYNCHRONIZATION 2048 /**< get server to do sleep in some places */
358
#endif /* End ifndef MYSQL_CLIENT */
360
/* The rest of the file is included in the server only */
363
/* Bits for different SQL modes modes (including ANSI mode) */
364
#define MODE_REAL_AS_FLOAT 1
365
#define MODE_PIPES_AS_CONCAT 2
366
#define MODE_ANSI_QUOTES 4
367
#define MODE_IGNORE_SPACE 8
368
#define MODE_NOT_USED 16
369
#define MODE_ONLY_FULL_GROUP_BY 32
370
#define MODE_NO_UNSIGNED_SUBTRACTION 64
371
#define MODE_NO_DIR_IN_CREATE 128
372
#define MODE_POSTGRESQL 256
373
#define MODE_ORACLE 512
374
#define MODE_MSSQL 1024
375
#define MODE_DB2 2048
376
#define MODE_MAXDB 4096
377
#define MODE_NO_KEY_OPTIONS 8192
378
#define MODE_NO_TABLE_OPTIONS 16384
379
#define MODE_NO_FIELD_OPTIONS 32768
380
#define MODE_MYSQL323 65536L
381
#define MODE_MYSQL40 (MODE_MYSQL323*2)
382
#define MODE_ANSI (MODE_MYSQL40*2)
383
#define MODE_NO_AUTO_VALUE_ON_ZERO (MODE_ANSI*2)
384
#define MODE_NO_BACKSLASH_ESCAPES (MODE_NO_AUTO_VALUE_ON_ZERO*2)
385
#define MODE_STRICT_TRANS_TABLES (MODE_NO_BACKSLASH_ESCAPES*2)
386
#define MODE_STRICT_ALL_TABLES (MODE_STRICT_TRANS_TABLES*2)
387
#define MODE_NO_ZERO_IN_DATE (MODE_STRICT_ALL_TABLES*2)
388
#define MODE_NO_ZERO_DATE (MODE_NO_ZERO_IN_DATE*2)
389
#define MODE_INVALID_DATES (MODE_NO_ZERO_DATE*2)
390
#define MODE_ERROR_FOR_DIVISION_BY_ZERO (MODE_INVALID_DATES*2)
391
#define MODE_TRADITIONAL (MODE_ERROR_FOR_DIVISION_BY_ZERO*2)
392
#define MODE_NO_AUTO_CREATE_USER (MODE_TRADITIONAL*2)
393
#define MODE_HIGH_NOT_PRECEDENCE (MODE_NO_AUTO_CREATE_USER*2)
394
#define MODE_NO_ENGINE_SUBSTITUTION (MODE_HIGH_NOT_PRECEDENCE*2)
395
#define MODE_PAD_CHAR_TO_FULL_LENGTH (1ULL << 31)
397
/* @@optimizer_switch flags */
398
#define OPTIMIZER_SWITCH_NO_MATERIALIZATION 1
399
#define OPTIMIZER_SWITCH_NO_SEMIJOIN 2
402
Replication uses 8 bytes to store SQL_MODE in the binary log. The day you
403
use strictly more than 64 bits by adding one more define above, you should
404
contact the replication team because the replication code should then be
405
updated (to store more bytes on disk).
407
NOTE: When adding new SQL_MODE types, make sure to also add them to
408
the scripts used for creating the MySQL system tables
409
in scripts/mysql_system_tables.sql and scripts/mysql_system_tables_fix.sql
412
#define RAID_BLOCK_SIZE 1024
414
#define MY_CHARSET_BIN_MB_MAXLEN 1
417
#define UNCACHEABLE_DEPENDENT 1
418
#define UNCACHEABLE_RAND 2
419
#define UNCACHEABLE_SIDEEFFECT 4
420
/// forcing to save JOIN for explain
421
#define UNCACHEABLE_EXPLAIN 8
422
/** Don't evaluate subqueries in prepare even if they're not correlated */
423
#define UNCACHEABLE_PREPARE 16
424
/* For uncorrelated SELECT in an UNION with some correlated SELECTs */
425
#define UNCACHEABLE_UNITED 32
427
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
428
#define UNDEF_POS (-1)
430
/* BINLOG_DUMP options */
432
#define BINLOG_DUMP_NON_BLOCK 1
434
/* sql_show.cc:show_log_files() */
435
#define SHOW_LOG_STATUS_FREE "FREE"
436
#define SHOW_LOG_STATUS_INUSE "IN USE"
438
/* Options to add_table_to_list() */
439
#define TL_OPTION_UPDATING 1
440
#define TL_OPTION_FORCE_INDEX 2
441
#define TL_OPTION_IGNORE_LEAVES 4
442
#define TL_OPTION_ALIAS 8
444
/* Some portable defines */
446
#define portable_sizeof_char_ptr 8
448
#define tmp_file_prefix "#sql" /**< Prefix for tmp tables */
449
#define tmp_file_prefix_length 4
451
/* Flags for calc_week() function. */
452
#define WEEK_MONDAY_FIRST 1
454
#define WEEK_FIRST_WEEKDAY 4
456
#define STRING_BUFFER_USUAL_SIZE 80
459
Some defines for exit codes for ::is_equal class functions.
461
#define IS_EQUAL_NO 0
462
#define IS_EQUAL_YES 1
463
#define IS_EQUAL_PACK_LENGTH 2
466
#endif /* DRIZZLE_SERVER_DEFINITIONS_H */