390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
243.1.12
by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from |
19 |
|
20 |
/**
|
|
21 |
* @file
|
|
22 |
*
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
23 |
* Mostly constants and some macros/functions used by the server
|
243.1.12
by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from |
24 |
*/
|
25 |
||
26 |
#ifndef DRIZZLE_SERVER_DEFINITIONS_H
|
|
27 |
#define DRIZZLE_SERVER_DEFINITIONS_H
|
|
28 |
||
1089.1.11
by Brian Aker
Cleanup on enum |
29 |
#include <drizzled/enum.h> |
30 |
||
575.1.6
by Monty Taylor
Cleaned up some headers for PCH. |
31 |
#include <stdint.h> |
32 |
||
243.1.12
by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from |
33 |
/* These paths are converted to other systems (WIN95) before use */
|
34 |
||
35 |
#define LANGUAGE "english/"
|
|
36 |
#define TEMP_PREFIX "MY"
|
|
37 |
#define LOG_PREFIX "ML"
|
|
38 |
#define PROGDIR "bin/"
|
|
39 |
||
549
by Monty Taylor
Took gettext.h out of header files. |
40 |
#define ER(X) error_message((X))
|
243.1.12
by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from |
41 |
|
42 |
#define LIBLEN FN_REFLEN-FN_LEN /* Max l{ngd p} dev */ |
|
43 |
/* extra 4+4 bytes for slave tmp tables */
|
|
44 |
#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4)
|
|
45 |
#define MAX_ALIAS_NAME 256
|
|
46 |
#define MAX_FIELD_NAME 34 /* Max colum name length +2 */ |
|
47 |
#define MAX_SYS_VAR_LENGTH 32
|
|
48 |
#define MAX_KEY MAX_INDEXES /* Max used keys */ |
|
49 |
#define MAX_REF_PARTS 16 /* Max parts used as ref */ |
|
50 |
#define MAX_KEY_LENGTH 4096 /* max possible key */ |
|
51 |
#define MAX_KEY_LENGTH_DECIMAL_WIDTH 4 /* strlen("4096") */ |
|
52 |
#if SIZEOF_OFF_T > 4
|
|
53 |
#define MAX_REFLENGTH 8 /* Max length for record ref */ |
|
54 |
#else
|
|
55 |
#define MAX_REFLENGTH 4 /* Max length for record ref */ |
|
56 |
#endif
|
|
57 |
#define MAX_HOSTNAME 61 /* len+1 in mysql.user */ |
|
58 |
||
59 |
#define MAX_MBWIDTH 4 /* Max multibyte sequence */ |
|
60 |
#define MAX_FIELD_CHARLENGTH 255
|
|
61 |
#define MAX_FIELD_VARCHARLENGTH 65535
|
|
62 |
#define CONVERT_IF_BIGGER_TO_BLOB 512 /* Used for CREATE ... SELECT */ |
|
63 |
||
64 |
/* Max column width +1 */
|
|
65 |
#define MAX_FIELD_WIDTH (MAX_FIELD_CHARLENGTH*MAX_MBWIDTH+1)
|
|
66 |
||
67 |
#define MAX_DATETIME_COMPRESSED_WIDTH 14 /* YYYYMMDDHHMMSS */ |
|
68 |
||
69 |
#define MAX_TABLES (sizeof(table_map)*8-3) /* Max tables in join */ |
|
70 |
#define PARAM_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-3))
|
|
71 |
#define OUTER_REF_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-2))
|
|
72 |
#define RAND_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-1))
|
|
73 |
#define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \
|
|
74 |
RAND_TABLE_BIT)
|
|
75 |
#define MAX_FIELDS 4096 /* Limit in the .frm file */ |
|
76 |
||
77 |
#define MAX_SELECT_NESTING (sizeof(nesting_map)*8-1)
|
|
78 |
||
79 |
#define MAX_SORT_MEMORY (2048*1024-MALLOC_OVERHEAD)
|
|
80 |
#define MIN_SORT_MEMORY (32*1024-MALLOC_OVERHEAD)
|
|
81 |
||
82 |
/* Memory allocated when parsing a statement / saving a statement */
|
|
83 |
#define MEM_ROOT_BLOCK_SIZE 8192
|
|
84 |
#define MEM_ROOT_PREALLOC 8192
|
|
85 |
#define TRANS_MEM_ROOT_BLOCK_SIZE 4096
|
|
86 |
#define TRANS_MEM_ROOT_PREALLOC 4096
|
|
87 |
||
88 |
#define DEFAULT_ERROR_COUNT 64
|
|
89 |
#define EXTRA_RECORDS 10 /* Extra records in sort */ |
|
90 |
#define SCROLL_EXTRA 5 /* Extra scroll-rows. */ |
|
895
by Brian Aker
Completion (?) of uint conversion. |
91 |
#define FIELD_NAME_USED ((uint32_t) 32768) /* Bit set if fieldname used */ |
243.1.12
by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from |
92 |
#define FIELD_NR_MASK 16383 /* To get fieldnumber */ |
93 |
#define FERR -1 /* Error from my_functions */ |
|
94 |
#define CREATE_MODE 0 /* Default mode on new files */ |
|
95 |
#define NAMES_SEP_CHAR '\377' /* Char to sep. names */ |
|
96 |
||
895
by Brian Aker
Completion (?) of uint conversion. |
97 |
#define READ_RECORD_BUFFER (uint32_t) (IO_SIZE*8) /* Pointer_buffer_size */ |
98 |
#define DISK_BUFFER_SIZE (uint32_t) (IO_SIZE*16) /* Size of diskbuffer */ |
|
243.1.12
by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from |
99 |
|
100 |
#define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH)
|
|
101 |
#define ME_ERROR (ME_BELL+ME_OLDWIN+ME_NOREFRESH)
|
|
102 |
#define MYF_RW MYF(MY_WME+MY_NABP) /* Vid my_read & my_write */ |
|
103 |
||
104 |
/* Defines for use with openfrm, openprt and openfrd */
|
|
105 |
||
106 |
#define READ_ALL 1 /* openfrm: Read all parameters */ |
|
107 |
#define CHANGE_FRM 2 /* openfrm: open .frm as O_RDWR */ |
|
108 |
#define EXTRA_RECORD 8 /* Reservera plats f|r extra record */ |
|
109 |
#define DONT_GIVE_ERROR 256 /* Don't do frm_error on openfrm */ |
|
110 |
#define DELAYED_OPEN 4096 /* Open table later */ |
|
111 |
/**
|
|
112 |
This flag is used in function get_all_tables() which fills
|
|
113 |
I_S tables with data which are retrieved from frm files and storage engine
|
|
114 |
The flag means that we need to open FRM file only to get necessary data.
|
|
115 |
*/
|
|
116 |
#define OPEN_FRM_FILE_ONLY 32768
|
|
117 |
/**
|
|
118 |
This flag is used in function get_all_tables() which fills
|
|
119 |
I_S tables with data which are retrieved from frm files and storage engine
|
|
120 |
The flag means that we need to process tables only to get necessary data.
|
|
121 |
Views are not processed.
|
|
122 |
*/
|
|
123 |
#define OPEN_TABLE_ONLY OPEN_FRM_FILE_ONLY*2
|
|
124 |
/**
|
|
125 |
This flag is used in function get_all_tables() which fills
|
|
126 |
I_S tables with data which are retrieved from frm files and storage engine.
|
|
127 |
The flag means that I_S table uses optimization algorithm.
|
|
128 |
*/
|
|
357
by Brian Aker
flag cleanup |
129 |
#define OPTIMIZE_I_S_TABLE OPEN_TABLE_ONLY*2
|
243.1.12
by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from |
130 |
|
131 |
/*
|
|
132 |
Minimum length pattern before Turbo Boyer-Moore is used
|
|
133 |
for SELECT "text" LIKE "%pattern%", excluding the two
|
|
134 |
wildcards in class Item_func_like.
|
|
135 |
*/
|
|
136 |
#define MIN_TURBOBM_PATTERN_LEN 3
|
|
137 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
138 |
/*
|
243.1.12
by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from |
139 |
Defines for binary logging.
|
140 |
Do not decrease the value of BIN_LOG_HEADER_SIZE.
|
|
141 |
Do not even increase it before checking code.
|
|
142 |
*/
|
|
143 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
144 |
#define BIN_LOG_HEADER_SIZE 4
|
243.1.12
by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from |
145 |
|
146 |
#define DEFAULT_KEY_CACHE_NAME "default"
|
|
147 |
||
148 |
#define STORAGE_TYPE_MASK 7
|
|
149 |
#define COLUMN_FORMAT_MASK 7
|
|
150 |
#define COLUMN_FORMAT_SHIFT 3
|
|
151 |
||
243.1.14
by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h |
152 |
/* Below are #defines that used to be in mysql_priv.h */
|
153 |
/***************************************************************************
|
|
154 |
Configuration parameters
|
|
155 |
****************************************************************************/
|
|
156 |
#define MAX_PASSWORD_LENGTH 32
|
|
157 |
#define MAX_ACCEPT_RETRY 10 // Test accept this many times |
|
158 |
#define MAX_FIELDS_BEFORE_HASH 32
|
|
159 |
#define USER_VARS_HASH_SIZE 16
|
|
160 |
#define TABLE_OPEN_CACHE_MIN 64
|
|
876
by Brian Aker
Removed some dead definitions. |
161 |
#define TABLE_OPEN_CACHE_DEFAULT 1024
|
243.1.14
by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h |
162 |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
163 |
/*
|
243.1.14
by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h |
164 |
Value of 9236 discovered through binary search 2006-09-26 on Ubuntu Dapper
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
165 |
Drake, libc6 2.3.6-0ubuntu2, Linux kernel 2.6.15-27-686, on x86. (Added
|
243.1.14
by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h |
166 |
100 bytes as reasonable buffer against growth and other environments'
|
167 |
requirements.)
|
|
168 |
||
169 |
Feel free to raise this by the smallest amount you can to get the
|
|
170 |
"execution_constants" test to pass.
|
|
171 |
*/
|
|
172 |
#define STACK_MIN_SIZE 12000 ///< Abort if less stack during eval. |
|
173 |
||
174 |
#define STACK_MIN_SIZE_FOR_OPEN 1024*80
|
|
175 |
#define STACK_BUFF_ALLOC 352 ///< For stack overrun checks |
|
176 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
177 |
/**
|
243.1.14
by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h |
178 |
* @TODO Move into a drizzled.h since it's only used in drizzled.cc
|
179 |
*
|
|
180 |
* @TODO Rename to DRIZZLED_NET_RETRY_COUNT
|
|
181 |
*/
|
|
182 |
#ifndef MYSQLD_NET_RETRY_COUNT
|
|
183 |
#define MYSQLD_NET_RETRY_COUNT 10 ///< Abort read after this many int. |
|
184 |
#endif
|
|
185 |
#define TEMP_POOL_SIZE 128
|
|
186 |
||
187 |
#define QUERY_ALLOC_BLOCK_SIZE 8192
|
|
188 |
#define QUERY_ALLOC_PREALLOC_SIZE 8192
|
|
189 |
#define TRANS_ALLOC_BLOCK_SIZE 4096
|
|
190 |
#define TRANS_ALLOC_PREALLOC_SIZE 4096
|
|
191 |
#define RANGE_ALLOC_BLOCK_SIZE 4096
|
|
192 |
#define UDF_ALLOC_BLOCK_SIZE 1024
|
|
193 |
#define TABLE_ALLOC_BLOCK_SIZE 1024
|
|
194 |
#define WARN_ALLOC_BLOCK_SIZE 2048
|
|
195 |
#define WARN_ALLOC_PREALLOC_SIZE 1024
|
|
196 |
#define PROFILE_ALLOC_BLOCK_SIZE 2048
|
|
197 |
#define PROFILE_ALLOC_PREALLOC_SIZE 1024
|
|
198 |
||
199 |
/*
|
|
200 |
The following parameters is to decide when to use an extra cache to
|
|
201 |
optimise seeks when reading a big table in sorted order
|
|
202 |
*/
|
|
203 |
#define MIN_FILE_LENGTH_TO_USE_ROW_CACHE (10L*1024*1024)
|
|
204 |
#define MIN_ROWS_TO_USE_TABLE_CACHE 100
|
|
205 |
#define MIN_ROWS_TO_USE_BULK_INSERT 100
|
|
206 |
||
207 |
/**
|
|
208 |
The following is used to decide if MySQL should use table scanning
|
|
209 |
instead of reading with keys. The number says how many evaluation of the
|
|
210 |
WHERE clause is comparable to reading one extra row from a table.
|
|
211 |
*/
|
|
212 |
#define TIME_FOR_COMPARE 5 // 5 compares == one read |
|
213 |
||
214 |
/**
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
215 |
Number of comparisons of table rowids equivalent to reading one row from a
|
243.1.14
by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h |
216 |
table.
|
217 |
*/
|
|
218 |
#define TIME_FOR_COMPARE_ROWID (TIME_FOR_COMPARE*2)
|
|
219 |
||
220 |
/*
|
|
221 |
For sequential disk seeks the cost formula is:
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
222 |
DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST * #blocks_to_skip
|
223 |
||
224 |
The cost of average seek
|
|
243.1.14
by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h |
225 |
DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST*BLOCKS_IN_AVG_SEEK =1.0.
|
226 |
*/
|
|
227 |
#define DISK_SEEK_BASE_COST ((double)0.9)
|
|
228 |
||
229 |
#define BLOCKS_IN_AVG_SEEK 128
|
|
230 |
||
231 |
#define DISK_SEEK_PROP_COST ((double)0.1/BLOCKS_IN_AVG_SEEK)
|
|
232 |
||
233 |
||
234 |
/**
|
|
235 |
Number of rows in a reference table when refereed through a not unique key.
|
|
236 |
This value is only used when we don't know anything about the key
|
|
237 |
distribution.
|
|
238 |
*/
|
|
239 |
#define MATCHING_ROWS_IN_OTHER_TABLE 10
|
|
240 |
||
241 |
/** Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used). */
|
|
242 |
#define KEY_DEFAULT_PACK_LENGTH 8
|
|
243 |
||
244 |
/** Characters shown for the command in 'show processlist'. */
|
|
245 |
#define PROCESS_LIST_WIDTH 100
|
|
246 |
/* Characters shown for the command in 'information_schema.processlist' */
|
|
247 |
#define PROCESS_LIST_INFO_WIDTH 65535
|
|
248 |
||
249 |
#define PRECISION_FOR_DOUBLE 53
|
|
250 |
#define PRECISION_FOR_FLOAT 24
|
|
251 |
||
252 |
/*
|
|
253 |
Default time to wait before aborting a new client connection
|
|
254 |
that does not respond to "initial server greeting" timely
|
|
255 |
*/
|
|
256 |
#define CONNECT_TIMEOUT 10
|
|
257 |
||
258 |
/* The following can also be changed from the command line */
|
|
259 |
#define DEFAULT_CONCURRENCY 10
|
|
260 |
#define FLUSH_TIME 0 /**< Don't flush tables */ |
|
261 |
#define MAX_CONNECT_ERRORS 10 ///< errors before disabling host |
|
262 |
||
263 |
#define INTERRUPT_PRIOR 10
|
|
264 |
#define CONNECT_PRIOR 9
|
|
265 |
#define WAIT_PRIOR 8
|
|
266 |
#define QUERY_PRIOR 6
|
|
267 |
||
1089.6.2
by Padraig O'Sullivan
Modified the size of the test_flags bitset to be 12 bits instead of 32. No |
268 |
/* Bits from testflag */
|
269 |
enum test_flag_bit |
|
270 |
{
|
|
271 |
TEST_PRINT_CACHED_TABLES= 1, |
|
272 |
TEST_NO_KEY_GROUP, |
|
273 |
TEST_MIT_THREAD, |
|
274 |
TEST_KEEP_TMP_TABLES, |
|
275 |
TEST_READCHECK, /**< Force use of readcheck */ |
|
276 |
TEST_NO_EXTRA, |
|
277 |
TEST_CORE_ON_SIGNAL, /**< Give core if signal */ |
|
278 |
TEST_NO_STACKTRACE, |
|
279 |
TEST_SIGINT, /**< Allow sigint on threads */ |
|
280 |
TEST_SYNCHRONIZATION /**< get server to do sleep in some places */ |
|
281 |
};
|
|
243.1.14
by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h |
282 |
|
283 |
/* Bits for different SQL modes modes (including ANSI mode) */
|
|
361
by Brian Aker
One more mode down, two more left to go! |
284 |
#define MODE_NO_ZERO_DATE (2)
|
243.1.14
by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h |
285 |
#define MODE_INVALID_DATES (MODE_NO_ZERO_DATE*2)
|
286 |
||
287 |
/* @@optimizer_switch flags */
|
|
288 |
#define OPTIMIZER_SWITCH_NO_MATERIALIZATION 1
|
|
289 |
#define OPTIMIZER_SWITCH_NO_SEMIJOIN 2
|
|
290 |
||
291 |
#define MY_CHARSET_BIN_MB_MAXLEN 1
|
|
292 |
||
293 |
// uncachable cause
|
|
294 |
#define UNCACHEABLE_DEPENDENT 1
|
|
295 |
#define UNCACHEABLE_RAND 2
|
|
296 |
#define UNCACHEABLE_SIDEEFFECT 4
|
|
297 |
/// forcing to save JOIN for explain
|
|
298 |
#define UNCACHEABLE_EXPLAIN 8
|
|
299 |
/** Don't evaluate subqueries in prepare even if they're not correlated */
|
|
300 |
#define UNCACHEABLE_PREPARE 16
|
|
301 |
/* For uncorrelated SELECT in an UNION with some correlated SELECTs */
|
|
302 |
#define UNCACHEABLE_UNITED 32
|
|
303 |
||
304 |
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
|
|
305 |
#define UNDEF_POS (-1)
|
|
306 |
||
307 |
/* sql_show.cc:show_log_files() */
|
|
308 |
#define SHOW_LOG_STATUS_FREE "FREE"
|
|
309 |
#define SHOW_LOG_STATUS_INUSE "IN USE"
|
|
310 |
||
311 |
/* Options to add_table_to_list() */
|
|
312 |
#define TL_OPTION_UPDATING 1
|
|
313 |
#define TL_OPTION_FORCE_INDEX 2
|
|
314 |
#define TL_OPTION_IGNORE_LEAVES 4
|
|
315 |
#define TL_OPTION_ALIAS 8
|
|
316 |
||
317 |
/* Some portable defines */
|
|
318 |
||
319 |
#define portable_sizeof_char_ptr 8
|
|
320 |
||
584.2.1
by Stewart Smith
convert tmp_file_prefix to TMP_FILE_PREFIX to indicate it's a macro |
321 |
#define TMP_FILE_PREFIX "#sql" /**< Prefix for tmp tables */ |
322 |
#define TMP_FILE_PREFIX_LENGTH 4
|
|
243.1.14
by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h |
323 |
|
324 |
/* Flags for calc_week() function. */
|
|
325 |
#define WEEK_MONDAY_FIRST 1
|
|
326 |
#define WEEK_YEAR 2
|
|
327 |
#define WEEK_FIRST_WEEKDAY 4
|
|
328 |
||
574.3.17
by Lee
moving functions from item_timefunc to functions/time directory |
329 |
/* used in date and time conversions */
|
330 |
/* Daynumber from year 0 to 9999-12-31 */
|
|
331 |
#define MAX_DAY_NUMBER 3652424L
|
|
332 |
||
243.1.14
by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h |
333 |
#define STRING_BUFFER_USUAL_SIZE 80
|
334 |
||
335 |
/*
|
|
336 |
Some defines for exit codes for ::is_equal class functions.
|
|
337 |
*/
|
|
338 |
#define IS_EQUAL_NO 0
|
|
339 |
#define IS_EQUAL_YES 1
|
|
340 |
#define IS_EQUAL_PACK_LENGTH 2
|
|
341 |
||
561.1.3
by Monty Taylor
Split some more things out of common_includes.h. |
342 |
|
553.1.2
by Monty Taylor
Moved some bitmap defines into bitmap. |
343 |
typedef uint64_t query_id_t; |
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
344 |
typedef void *range_seq_t; |
345 |
||
520.6.7
by Monty Taylor
Moved a bunch of crap out of common_includes. |
346 |
/* masks for start/stop operations on io and sql slave threads */
|
347 |
#define SLAVE_IO 1
|
|
348 |
#define SLAVE_SQL 2
|
|
349 |
||
520.8.6
by Monty Taylor
Removed handler from common_includes. |
350 |
#ifndef NO_HASH
|
351 |
#define NO_HASH /* Not yet implemented */ |
|
352 |
#endif
|
|
353 |
||
354 |
// the following is for checking tables
|
|
355 |
||
356 |
#define HA_ADMIN_ALREADY_DONE 1
|
|
357 |
#define HA_ADMIN_OK 0
|
|
358 |
#define HA_ADMIN_NOT_IMPLEMENTED -1
|
|
359 |
#define HA_ADMIN_FAILED -2
|
|
360 |
#define HA_ADMIN_CORRUPT -3
|
|
361 |
#define HA_ADMIN_INTERNAL_ERROR -4
|
|
362 |
#define HA_ADMIN_INVALID -5
|
|
363 |
#define HA_ADMIN_REJECT -6
|
|
364 |
#define HA_ADMIN_TRY_ALTER -7
|
|
365 |
#define HA_ADMIN_NEEDS_UPGRADE -10
|
|
366 |
#define HA_ADMIN_NEEDS_ALTER -11
|
|
367 |
#define HA_ADMIN_NEEDS_CHECK -12
|
|
368 |
||
369 |
||
370 |
/* Remember to increase HA_MAX_ALTER_FLAGS when adding more flags! */
|
|
371 |
||
372 |
/* Return values for check_if_supported_alter */
|
|
373 |
||
374 |
#define HA_ALTER_ERROR -1
|
|
375 |
#define HA_ALTER_SUPPORTED_WAIT_LOCK 0
|
|
376 |
#define HA_ALTER_SUPPORTED_NO_LOCK 1
|
|
377 |
#define HA_ALTER_NOT_SUPPORTED 2
|
|
378 |
||
379 |
/* Bits in table_flags() to show what database can do */
|
|
380 |
||
381 |
#define HA_NO_TRANSACTIONS (1 << 0) /* Doesn't support transactions */ |
|
382 |
#define HA_PARTIAL_COLUMN_READ (1 << 1) /* read may not return all columns */ |
|
383 |
#define HA_TABLE_SCAN_ON_INDEX (1 << 2) /* No separate data/index file */ |
|
384 |
/*
|
|
385 |
The following should be set if the following is not true when scanning
|
|
386 |
a table with rnd_next()
|
|
387 |
- We will see all rows (including deleted ones)
|
|
388 |
- Row positions are 'table->s->db_record_offset' apart
|
|
389 |
If this flag is not set, filesort will do a postion() call for each matched
|
|
390 |
row to be able to find the row later.
|
|
391 |
*/
|
|
392 |
#define HA_REC_NOT_IN_SEQ (1 << 3)
|
|
393 |
||
394 |
/*
|
|
395 |
Reading keys in random order is as fast as reading keys in sort order
|
|
396 |
(Used in records.cc to decide if we should use a record cache and by
|
|
397 |
filesort to decide if we should sort key + data or key + pointer-to-row
|
|
398 |
*/
|
|
399 |
#define HA_FAST_KEY_READ (1 << 5)
|
|
400 |
/*
|
|
401 |
Set the following flag if we on delete should force all key to be read
|
|
402 |
and on update read all keys that changes
|
|
403 |
*/
|
|
404 |
#define HA_REQUIRES_KEY_COLUMNS_FOR_DELETE (1 << 6)
|
|
405 |
#define HA_NULL_IN_KEY (1 << 7) /* One can have keys with NULL */ |
|
406 |
#define HA_DUPLICATE_POS (1 << 8) /* ha_position() gives dup row */ |
|
407 |
#define HA_NO_BLOBS (1 << 9) /* Doesn't support blobs */ |
|
408 |
#define HA_CAN_INDEX_BLOBS (1 << 10)
|
|
409 |
#define HA_AUTO_PART_KEY (1 << 11) /* auto-increment in multi-part key */ |
|
410 |
#define HA_REQUIRE_PRIMARY_KEY (1 << 12) /* .. and can't create a hidden one */ |
|
411 |
#define HA_STATS_RECORDS_IS_EXACT (1 << 13) /* stats.records is exact */ |
|
412 |
/*
|
|
413 |
If we get the primary key columns for free when we do an index read
|
|
414 |
It also implies that we have to retrive the primary key when using
|
|
415 |
position() and rnd_pos().
|
|
416 |
*/
|
|
417 |
#define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)
|
|
418 |
/*
|
|
419 |
If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position()
|
|
420 |
uses a primary key. Without primary key, we can't call position().
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
421 |
*/
|
422 |
#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1 << 16)
|
|
520.8.6
by Monty Taylor
Removed handler from common_includes. |
423 |
#define HA_NOT_DELETE_WITH_CACHE (1 << 18)
|
424 |
/*
|
|
425 |
The following is we need to a primary key to delete (and update) a row.
|
|
426 |
If there is no primary key, all columns needs to be read on update and delete
|
|
427 |
*/
|
|
428 |
#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE (1 << 19)
|
|
429 |
#define HA_NO_PREFIX_CHAR_KEYS (1 << 20)
|
|
430 |
#define HA_NO_AUTO_INCREMENT (1 << 23)
|
|
431 |
#define HA_HAS_CHECKSUM (1 << 24)
|
|
432 |
/* Table data are stored in separate files (for lower_case_table_names) */
|
|
433 |
#define HA_FILE_BASED (1 << 26)
|
|
434 |
#define HA_NEED_READ_RANGE_BUFFER (1 << 29) /* for read_multi_range */ |
|
435 |
#define HA_ANY_INDEX_MAY_BE_UNIQUE (1 << 30)
|
|
436 |
#define HA_HAS_RECORDS (INT64_C(1) << 32) /* records() gives exact count*/ |
|
437 |
#define HA_MRR_CANT_SORT (INT64_C(1) << 34)
|
|
438 |
||
439 |
/* bits in index_flags(index_number) for what you can do with index */
|
|
440 |
#define HA_READ_NEXT 1 /* TODO really use this flag */ |
|
441 |
#define HA_READ_PREV 2 /* supports ::index_prev */ |
|
442 |
#define HA_READ_ORDER 4 /* index_next/prev follow sort order */ |
|
443 |
#define HA_READ_RANGE 8 /* can find all records in a range */ |
|
444 |
#define HA_ONLY_WHOLE_INDEX 16 /* Can't use part key searches */ |
|
445 |
#define HA_KEYREAD_ONLY 64 /* Support HA_EXTRA_KEYREAD */ |
|
446 |
/*
|
|
447 |
Index scan will not return records in rowid order. Not guaranteed to be
|
|
448 |
set for unordered (e.g. HASH) indexes.
|
|
449 |
*/
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
450 |
#define HA_KEY_SCAN_NOT_ROR 128
|
520.8.6
by Monty Taylor
Removed handler from common_includes. |
451 |
#define HA_DO_INDEX_COND_PUSHDOWN 256 /* Supports Index Condition Pushdown */ |
452 |
||
453 |
/* operations for disable/enable indexes */
|
|
454 |
#define HA_KEY_SWITCH_NONUNIQ 0
|
|
455 |
#define HA_KEY_SWITCH_ALL 1
|
|
456 |
#define HA_KEY_SWITCH_NONUNIQ_SAVE 2
|
|
457 |
#define HA_KEY_SWITCH_ALL_SAVE 3
|
|
458 |
||
459 |
/*
|
|
460 |
Note: the following includes binlog and closing 0.
|
|
461 |
so: innodb + bdb + ndb + binlog + myisam + myisammrg + archive +
|
|
462 |
example + csv + heap + blackhole + federated + 0
|
|
463 |
(yes, the sum is deliberately inaccurate)
|
|
464 |
TODO remove the limit, use dynarrays
|
|
465 |
*/
|
|
466 |
#define MAX_HA 15
|
|
467 |
||
468 |
/*
|
|
469 |
Parameters for open() (in register form->filestat)
|
|
470 |
HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED
|
|
471 |
*/
|
|
472 |
||
473 |
#define HA_OPEN_KEYFILE 1
|
|
474 |
#define HA_OPEN_RNDFILE 2
|
|
475 |
#define HA_GET_INDEX 4
|
|
476 |
#define HA_GET_INFO 8 /* do a ha_info() after open */ |
|
477 |
#define HA_READ_ONLY 16 /* File opened as readonly */ |
|
478 |
/* Try readonly if can't open with read and write */
|
|
479 |
#define HA_TRY_READ_ONLY 32
|
|
480 |
#define HA_WAIT_IF_LOCKED 64 /* Wait if locked on open */ |
|
481 |
#define HA_ABORT_IF_LOCKED 128 /* skip if locked on open.*/ |
|
482 |
#define HA_BLOCK_LOCK 256 /* unlock when reading some records */ |
|
483 |
#define HA_OPEN_TEMPORARY 512
|
|
484 |
||
485 |
/* For transactional LOCK Table. handler::lock_table() */
|
|
486 |
#define HA_LOCK_IN_SHARE_MODE F_RDLCK
|
|
487 |
#define HA_LOCK_IN_EXCLUSIVE_MODE F_WRLCK
|
|
488 |
||
489 |
/* Some key definitions */
|
|
490 |
#define HA_KEY_NULL_LENGTH 1
|
|
491 |
#define HA_KEY_BLOB_LENGTH 2
|
|
492 |
||
493 |
#define HA_LEX_CREATE_TMP_TABLE 1
|
|
494 |
#define HA_LEX_CREATE_IF_NOT_EXISTS 2
|
|
495 |
#define HA_LEX_CREATE_TABLE_LIKE 4
|
|
496 |
#define HA_OPTION_NO_CHECKSUM (1L << 17)
|
|
497 |
#define HA_OPTION_NO_DELAY_KEY_WRITE (1L << 18)
|
|
498 |
#define HA_MAX_REC_LENGTH 65535
|
|
499 |
||
500 |
/* Options of START TRANSACTION statement (and later of SET TRANSACTION stmt) */
|
|
501 |
#define DRIZZLE_START_TRANS_OPT_WITH_CONS_SNAPSHOT 1
|
|
502 |
||
503 |
/* Flags for method is_fatal_error */
|
|
504 |
#define HA_CHECK_DUP_KEY 1
|
|
505 |
#define HA_CHECK_DUP_UNIQUE 2
|
|
506 |
#define HA_CHECK_DUP (HA_CHECK_DUP_KEY + HA_CHECK_DUP_UNIQUE)
|
|
507 |
||
508 |
||
509 |
/* Bits in used_fields */
|
|
510 |
#define HA_CREATE_USED_AUTO (1L << 0)
|
|
511 |
#ifdef DEAD_OPTIONS
|
|
512 |
#define HA_CREATE_USED_UNION (1L << 2)
|
|
513 |
#define HA_CREATE_USED_PASSWORD (1L << 17)
|
|
514 |
#endif
|
|
515 |
#define HA_CREATE_USED_INSERT_METHOD (1L << 3)
|
|
516 |
#define HA_CREATE_USED_MIN_ROWS (1L << 4)
|
|
517 |
#define HA_CREATE_USED_MAX_ROWS (1L << 5)
|
|
518 |
#define HA_CREATE_USED_AVG_ROW_LENGTH (1L << 6)
|
|
519 |
#define HA_CREATE_USED_PACK_KEYS (1L << 7)
|
|
520 |
#define HA_CREATE_USED_CHARSET (1L << 8)
|
|
521 |
#define HA_CREATE_USED_DEFAULT_CHARSET (1L << 9)
|
|
522 |
#define HA_CREATE_USED_DATADIR (1L << 10)
|
|
523 |
#define HA_CREATE_USED_INDEXDIR (1L << 11)
|
|
524 |
#define HA_CREATE_USED_ENGINE (1L << 12)
|
|
525 |
#define HA_CREATE_USED_CHECKSUM (1L << 13)
|
|
526 |
#define HA_CREATE_USED_DELAY_KEY_WRITE (1L << 14)
|
|
527 |
#define HA_CREATE_USED_ROW_FORMAT (1L << 15)
|
|
528 |
#define HA_CREATE_USED_COMMENT (1L << 16)
|
|
529 |
#define HA_CREATE_USED_CONNECTION (1L << 18)
|
|
530 |
#define HA_CREATE_USED_KEY_BLOCK_SIZE (1L << 19)
|
|
531 |
#define HA_CREATE_USED_PAGE_CHECKSUM (1L << 21)
|
|
532 |
#define HA_CREATE_USED_BLOCK_SIZE (1L << 22)
|
|
533 |
||
534 |
#define MAXGTRIDSIZE 64
|
|
535 |
#define MAXBQUALSIZE 64
|
|
536 |
||
537 |
/*
|
|
538 |
The below two are not used (and not handled) in this milestone of this WL
|
|
539 |
entry because there seems to be no use for them at this stage of
|
|
540 |
implementation.
|
|
541 |
*/
|
|
542 |
#define HA_MRR_SINGLE_POINT 1
|
|
543 |
#define HA_MRR_FIXED_KEY 2
|
|
544 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
545 |
/*
|
520.8.6
by Monty Taylor
Removed handler from common_includes. |
546 |
Indicates that RANGE_SEQ_IF::next(&range) doesn't need to fill in the
|
547 |
'range' parameter.
|
|
548 |
*/
|
|
549 |
#define HA_MRR_NO_ASSOCIATION 4
|
|
550 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
551 |
/*
|
520.8.6
by Monty Taylor
Removed handler from common_includes. |
552 |
The MRR user will provide ranges in key order, and MRR implementation
|
553 |
must return rows in key order.
|
|
554 |
*/
|
|
555 |
#define HA_MRR_SORTED 8
|
|
556 |
||
557 |
/* MRR implementation doesn't have to retrieve full records */
|
|
558 |
#define HA_MRR_INDEX_ONLY 16
|
|
559 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
560 |
/*
|
520.8.6
by Monty Taylor
Removed handler from common_includes. |
561 |
The passed memory buffer is of maximum possible size, the caller can't
|
562 |
assume larger buffer.
|
|
563 |
*/
|
|
564 |
#define HA_MRR_LIMITS 32
|
|
565 |
||
566 |
||
567 |
/*
|
|
568 |
Flag set <=> default MRR implementation is used
|
|
569 |
(The choice is made by **_info[_const]() function which may set this
|
|
570 |
flag. SQL layer remembers the flag value and then passes it to
|
|
571 |
multi_read_range_init().
|
|
572 |
*/
|
|
573 |
#define HA_MRR_USE_DEFAULT_IMPL 64
|
|
574 |
||
575 |
/*
|
|
576 |
Used only as parameter to multi_range_read_info():
|
|
577 |
Flag set <=> the caller guarantees that the bounds of the scanned ranges
|
|
578 |
will not have NULL values.
|
|
579 |
*/
|
|
580 |
#define HA_MRR_NO_NULL_ENDPOINTS 128
|
|
581 |
||
575.1.6
by Monty Taylor
Cleaned up some headers for PCH. |
582 |
typedef int myf; |
583 |
#define MYF(v) (myf) (v)
|
|
584 |
||
584.1.1
by Monty Taylor
Moved an enum def to fix Lee's problem. |
585 |
#define MY_I_S_MAYBE_NULL 1
|
586 |
#define MY_I_S_UNSIGNED 2
|
|
587 |
||
588 |
||
589 |
#define SKIP_OPEN_TABLE 0 // do not open table |
|
590 |
#define OPEN_FRM_ONLY 1 // open FRM file only |
|
591 |
#define OPEN_FULL_TABLE 2 // open FRM,MYD, MYI files |
|
592 |
||
584.4.1
by Monty Taylor
Split out DTCollation. |
593 |
/*
|
594 |
"Declared Type Collation"
|
|
595 |
A combination of collation and its derivation.
|
|
596 |
||
597 |
Flags for collation aggregation modes:
|
|
598 |
MY_COLL_ALLOW_SUPERSET_CONV - allow conversion to a superset
|
|
599 |
MY_COLL_ALLOW_COERCIBLE_CONV - allow conversion of a coercible value
|
|
600 |
(i.e. constant).
|
|
601 |
MY_COLL_ALLOW_CONV - allow any kind of conversion
|
|
602 |
(combination of the above two)
|
|
603 |
MY_COLL_DISALLOW_NONE - don't allow return DERIVATION_NONE
|
|
604 |
(e.g. when aggregating for comparison)
|
|
605 |
MY_COLL_CMP_CONV - combination of MY_COLL_ALLOW_CONV
|
|
606 |
and MY_COLL_DISALLOW_NONE
|
|
607 |
*/
|
|
608 |
||
609 |
#define MY_COLL_ALLOW_SUPERSET_CONV 1
|
|
610 |
#define MY_COLL_ALLOW_COERCIBLE_CONV 2
|
|
611 |
#define MY_COLL_ALLOW_CONV 3
|
|
612 |
#define MY_COLL_DISALLOW_NONE 4
|
|
613 |
#define MY_COLL_CMP_CONV 7
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
614 |
#define clear_timestamp_auto_bits(_target_, _bits_) \
|
615 |
(_target_)= (enum timestamp_auto_set_type)((int)(_target_) & ~(int)(_bits_))
|
|
616 |
||
584.5.1
by Monty Taylor
Removed field includes from field.h. |
617 |
/*
|
618 |
* The following are for the interface with the .frm file
|
|
619 |
*/
|
|
620 |
||
621 |
#define FIELDFLAG_DECIMAL 1
|
|
622 |
#define FIELDFLAG_BINARY 1 // Shares same flag |
|
623 |
#define FIELDFLAG_NUMBER 2
|
|
624 |
#define FIELDFLAG_DECIMAL_POSITION 4
|
|
625 |
#define FIELDFLAG_PACK 120 // Bits used for packing |
|
626 |
#define FIELDFLAG_INTERVAL 256 // mangled with decimals! |
|
627 |
#define FIELDFLAG_BLOB 1024 // mangled with decimals! |
|
628 |
||
629 |
#define FIELDFLAG_NO_DEFAULT 16384 /* sql */ |
|
630 |
#define FIELDFLAG_SUM ((uint32_t) 32768)// predit: +#fieldflag |
|
631 |
#define FIELDFLAG_MAYBE_NULL ((uint32_t) 32768)// sql |
|
632 |
#define FIELDFLAG_HEX_ESCAPE ((uint32_t) 0x10000)
|
|
633 |
#define FIELDFLAG_PACK_SHIFT 3
|
|
634 |
#define FIELDFLAG_DEC_SHIFT 8
|
|
635 |
#define FIELDFLAG_MAX_DEC 31
|
|
636 |
||
637 |
#define MTYP_TYPENR(type) (type & 127) /* Remove bits from type */ |
|
638 |
||
639 |
#define f_is_dec(x) ((x) & FIELDFLAG_DECIMAL)
|
|
640 |
#define f_is_num(x) ((x) & FIELDFLAG_NUMBER)
|
|
641 |
#define f_is_decimal_precision(x) ((x) & FIELDFLAG_DECIMAL_POSITION)
|
|
642 |
#define f_is_packed(x) ((x) & FIELDFLAG_PACK)
|
|
643 |
#define f_packtype(x) (((x) >> FIELDFLAG_PACK_SHIFT) & 15)
|
|
644 |
#define f_decimals(x) ((uint8_t) (((x) >> FIELDFLAG_DEC_SHIFT) & \
|
|
645 |
FIELDFLAG_MAX_DEC))
|
|
646 |
#define f_is_alpha(x) (!f_is_num(x))
|
|
647 |
#define f_is_binary(x) ((x) & FIELDFLAG_BINARY) // 4.0- compatibility |
|
648 |
#define f_is_enum(x) (((x) & (FIELDFLAG_INTERVAL | FIELDFLAG_NUMBER)) == \
|
|
649 |
FIELDFLAG_INTERVAL)
|
|
650 |
#define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == \
|
|
651 |
FIELDFLAG_BLOB)
|
|
652 |
#define f_is_equ(x) ((x) & (1+2+FIELDFLAG_PACK+31*256))
|
|
653 |
#define f_settype(x) (((int) x) << FIELDFLAG_PACK_SHIFT)
|
|
654 |
#define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL)
|
|
655 |
#define f_no_default(x) (x & FIELDFLAG_NO_DEFAULT)
|
|
656 |
#define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE)
|
|
657 |
||
243.1.12
by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from |
658 |
#endif /* DRIZZLE_SERVER_DEFINITIONS_H */ |
575.4.7
by Monty Taylor
More header cleanup. |
659 |