~drizzle-trunk/drizzle/development

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
1119.9.4 by Jay Pipes
Removes the FIELDFLAG_NO_DEFAULT bit and f_no_default macro and calls
26
#ifndef DRIZZLED_DEFINITIONS_H
27
#define DRIZZLED_DEFINITIONS_H
243.1.12 by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from
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
86
#define DEFAULT_ERROR_COUNT	64
87
#define EXTRA_RECORDS	10			/* Extra records in sort */
88
#define SCROLL_EXTRA	5			/* Extra scroll-rows. */
895 by Brian Aker
Completion (?) of uint conversion.
89
#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
90
#define FIELD_NR_MASK	16383			/* To get fieldnumber */
91
#define FERR		-1			/* Error from my_functions */
92
#define CREATE_MODE	0			/* Default mode on new files */
93
#define NAMES_SEP_CHAR	'\377'			/* Char to sep. names */
94
895 by Brian Aker
Completion (?) of uint conversion.
95
#define READ_RECORD_BUFFER	(uint32_t) (IO_SIZE*8) /* Pointer_buffer_size */
96
#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
97
98
#define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH)
99
#define ME_ERROR (ME_BELL+ME_OLDWIN+ME_NOREFRESH)
100
#define MYF_RW MYF(MY_WME+MY_NABP)		/* Vid my_read & my_write */
101
102
	/* Defines for use with openfrm, openprt and openfrd */
103
104
#define READ_ALL		1	/* openfrm: Read all parameters */
105
#define EXTRA_RECORD		8	/* Reservera plats f|r extra record */
106
#define DONT_GIVE_ERROR		256	/* Don't do frm_error on openfrm  */
107
#define DELAYED_OPEN		4096	/* Open table later */
108
/**
109
  This flag is used in function get_all_tables() which fills
110
  I_S tables with data which are retrieved from frm files and storage engine
111
  The flag means that we need to open FRM file only to get necessary data.
112
*/
113
#define OPEN_FRM_FILE_ONLY     32768
114
/**
115
  This flag is used in function get_all_tables() which fills
116
  I_S tables with data which are retrieved from frm files and storage engine
117
  The flag means that we need to process tables only to get necessary data.
118
  Views are not processed.
119
*/
120
#define OPEN_TABLE_ONLY        OPEN_FRM_FILE_ONLY*2
121
/**
122
  This flag is used in function get_all_tables() which fills
123
  I_S tables with data which are retrieved from frm files and storage engine.
124
  The flag means that I_S table uses optimization algorithm.
125
*/
357 by Brian Aker
flag cleanup
126
#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
127
128
/*
129
  Minimum length pattern before Turbo Boyer-Moore is used
130
  for SELECT "text" LIKE "%pattern%", excluding the two
131
  wildcards in class Item_func_like.
132
*/
133
#define MIN_TURBOBM_PATTERN_LEN 3
134
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
135
/*
243.1.12 by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from
136
   Defines for binary logging.
137
   Do not decrease the value of BIN_LOG_HEADER_SIZE.
138
   Do not even increase it before checking code.
139
*/
140
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
141
#define BIN_LOG_HEADER_SIZE    4
243.1.12 by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from
142
143
#define COLUMN_FORMAT_MASK 7
144
#define COLUMN_FORMAT_SHIFT 3
145
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
146
/* Below are #defines that used to be in mysql_priv.h */
147
/***************************************************************************
148
  Configuration parameters
149
****************************************************************************/
150
#define MAX_ACCEPT_RETRY	10	// Test accept this many times
151
#define MAX_FIELDS_BEFORE_HASH	32
152
#define USER_VARS_HASH_SIZE     16
153
#define TABLE_OPEN_CACHE_MIN    64
876 by Brian Aker
Removed some dead definitions.
154
#define TABLE_OPEN_CACHE_DEFAULT 1024
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
155
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
156
/*
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
157
 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:
158
 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
159
 100 bytes as reasonable buffer against growth and other environments'
160
 requirements.)
161
162
 Feel free to raise this by the smallest amount you can to get the
163
 "execution_constants" test to pass.
164
 */
165
#define STACK_MIN_SIZE          12000   ///< Abort if less stack during eval.
166
167
#define STACK_MIN_SIZE_FOR_OPEN 1024*80
168
#define STACK_BUFF_ALLOC        352     ///< For stack overrun checks
169
170
#define TEMP_POOL_SIZE          128
171
172
#define QUERY_ALLOC_BLOCK_SIZE		8192
173
#define QUERY_ALLOC_PREALLOC_SIZE   	8192
174
#define TRANS_ALLOC_BLOCK_SIZE		4096
175
#define TRANS_ALLOC_PREALLOC_SIZE	4096
176
#define RANGE_ALLOC_BLOCK_SIZE		4096
177
#define TABLE_ALLOC_BLOCK_SIZE		1024
178
#define WARN_ALLOC_BLOCK_SIZE		2048
179
#define WARN_ALLOC_PREALLOC_SIZE	1024
180
181
/*
182
  The following parameters is to decide when to use an extra cache to
183
  optimise seeks when reading a big table in sorted order
184
*/
185
#define MIN_FILE_LENGTH_TO_USE_ROW_CACHE (10L*1024*1024)
186
#define MIN_ROWS_TO_USE_TABLE_CACHE	 100
187
#define MIN_ROWS_TO_USE_BULK_INSERT	 100
188
189
/**
190
  The following is used to decide if MySQL should use table scanning
191
  instead of reading with keys.  The number says how many evaluation of the
192
  WHERE clause is comparable to reading one extra row from a table.
193
*/
194
#define TIME_FOR_COMPARE   5	// 5 compares == one read
195
196
/**
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
197
  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
198
  table.
199
*/
200
#define TIME_FOR_COMPARE_ROWID  (TIME_FOR_COMPARE*2)
201
202
/*
203
  For sequential disk seeks the cost formula is:
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
204
    DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST * #blocks_to_skip
205
206
  The cost of average seek
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
207
    DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST*BLOCKS_IN_AVG_SEEK =1.0.
208
*/
209
#define DISK_SEEK_BASE_COST ((double)0.9)
210
211
#define BLOCKS_IN_AVG_SEEK  128
212
213
#define DISK_SEEK_PROP_COST ((double)0.1/BLOCKS_IN_AVG_SEEK)
214
215
216
/**
217
  Number of rows in a reference table when refereed through a not unique key.
218
  This value is only used when we don't know anything about the key
219
  distribution.
220
*/
221
#define MATCHING_ROWS_IN_OTHER_TABLE 10
222
223
/** Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used). */
224
#define KEY_DEFAULT_PACK_LENGTH 8
225
226
/** Characters shown for the command in 'show processlist'. */
227
#define PROCESS_LIST_WIDTH 100
228
/* Characters shown for the command in 'information_schema.processlist' */
229
#define PROCESS_LIST_INFO_WIDTH 65535
230
231
#define PRECISION_FOR_DOUBLE 53
232
#define PRECISION_FOR_FLOAT  24
233
234
/* The following can also be changed from the command line */
235
#define DEFAULT_CONCURRENCY	10
236
#define FLUSH_TIME		0		/**< Don't flush tables */
237
#define MAX_CONNECT_ERRORS	10		///< errors before disabling host
238
239
#define INTERRUPT_PRIOR 10
240
#define CONNECT_PRIOR	9
241
#define WAIT_PRIOR	8
242
#define QUERY_PRIOR	6
243
1089.6.2 by Padraig O'Sullivan
Modified the size of the test_flags bitset to be 12 bits instead of 32. No
244
/* Bits from testflag */
245
enum test_flag_bit
246
{
247
  TEST_PRINT_CACHED_TABLES= 1,
248
  TEST_NO_KEY_GROUP,
249
  TEST_MIT_THREAD,
250
  TEST_KEEP_TMP_TABLES,
251
  TEST_READCHECK, /**< Force use of readcheck */
252
  TEST_NO_EXTRA,
253
  TEST_CORE_ON_SIGNAL, /**< Give core if signal */
254
  TEST_NO_STACKTRACE,
255
  TEST_SIGINT, /**< Allow sigint on threads */
256
  TEST_SYNCHRONIZATION /**< get server to do sleep in some places */
257
};
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
258
259
/* Bits for different SQL modes modes (including ANSI mode) */
361 by Brian Aker
One more mode down, two more left to go!
260
#define MODE_NO_ZERO_DATE		(2)
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
261
#define MODE_INVALID_DATES		(MODE_NO_ZERO_DATE*2)
262
263
/* @@optimizer_switch flags */
264
#define OPTIMIZER_SWITCH_NO_MATERIALIZATION 1
265
#define OPTIMIZER_SWITCH_NO_SEMIJOIN 2
266
267
#define MY_CHARSET_BIN_MB_MAXLEN 1
268
269
// uncachable cause
270
#define UNCACHEABLE_DEPENDENT   1
271
#define UNCACHEABLE_RAND        2
272
#define UNCACHEABLE_SIDEEFFECT	4
273
/// forcing to save JOIN for explain
274
#define UNCACHEABLE_EXPLAIN     8
275
/** Don't evaluate subqueries in prepare even if they're not correlated */
276
#define UNCACHEABLE_PREPARE    16
277
/* For uncorrelated SELECT in an UNION with some correlated SELECTs */
278
#define UNCACHEABLE_UNITED     32
279
280
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
281
#define UNDEF_POS (-1)
282
283
/* sql_show.cc:show_log_files() */
284
#define SHOW_LOG_STATUS_FREE "FREE"
285
#define SHOW_LOG_STATUS_INUSE "IN USE"
286
287
/* Options to add_table_to_list() */
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
292
293
/* Some portable defines */
294
295
#define portable_sizeof_char_ptr 8
296
584.2.1 by Stewart Smith
convert tmp_file_prefix to TMP_FILE_PREFIX to indicate it's a macro
297
#define TMP_FILE_PREFIX "#sql"			/**< Prefix for tmp tables */
298
#define TMP_FILE_PREFIX_LENGTH 4
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
299
300
/* Flags for calc_week() function.  */
301
#define WEEK_MONDAY_FIRST    1
302
#define WEEK_YEAR            2
303
#define WEEK_FIRST_WEEKDAY   4
304
574.3.17 by Lee
moving functions from item_timefunc to functions/time directory
305
/* used in date and time conversions */
306
/* Daynumber from year 0 to 9999-12-31 */
307
#define MAX_DAY_NUMBER 3652424L
308
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
309
#define STRING_BUFFER_USUAL_SIZE 80
310
311
/*
312
  Some defines for exit codes for ::is_equal class functions.
313
*/
314
#define IS_EQUAL_NO 0
315
#define IS_EQUAL_YES 1
316
#define IS_EQUAL_PACK_LENGTH 2
317
561.1.3 by Monty Taylor
Split some more things out of common_includes.h.
318
553.1.2 by Monty Taylor
Moved some bitmap defines into bitmap.
319
typedef uint64_t query_id_t;
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
320
typedef void *range_seq_t;
321
1130.1.5 by Monty Taylor
Split StorageEngine into slot. This completes the plugin-slot-reorg. Woot.
322
enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX };
520.8.6 by Monty Taylor
Removed handler from common_includes.
323
// the following is for checking tables
324
325
#define HA_ADMIN_ALREADY_DONE	  1
326
#define HA_ADMIN_OK               0
327
#define HA_ADMIN_NOT_IMPLEMENTED -1
328
#define HA_ADMIN_FAILED		 -2
329
#define HA_ADMIN_CORRUPT         -3
330
#define HA_ADMIN_INTERNAL_ERROR  -4
331
#define HA_ADMIN_INVALID         -5
332
#define HA_ADMIN_REJECT          -6
333
#define HA_ADMIN_TRY_ALTER       -7
334
#define HA_ADMIN_NEEDS_UPGRADE  -10
335
#define HA_ADMIN_NEEDS_ALTER    -11
336
#define HA_ADMIN_NEEDS_CHECK    -12
337
338
/* Bits in table_flags() to show what database can do */
339
340
#define HA_NO_TRANSACTIONS     (1 << 0) /* Doesn't support transactions */
341
#define HA_PARTIAL_COLUMN_READ (1 << 1) /* read may not return all columns */
342
#define HA_TABLE_SCAN_ON_INDEX (1 << 2) /* No separate data/index file */
343
/*
344
  The following should be set if the following is not true when scanning
345
  a table with rnd_next()
346
  - We will see all rows (including deleted ones)
347
  - Row positions are 'table->s->db_record_offset' apart
348
  If this flag is not set, filesort will do a postion() call for each matched
349
  row to be able to find the row later.
350
*/
351
#define HA_REC_NOT_IN_SEQ      (1 << 3)
352
353
/*
354
  Reading keys in random order is as fast as reading keys in sort order
355
  (Used in records.cc to decide if we should use a record cache and by
356
  filesort to decide if we should sort key + data or key + pointer-to-row
357
*/
358
#define HA_FAST_KEY_READ       (1 << 5)
359
/*
360
  Set the following flag if we on delete should force all key to be read
361
  and on update read all keys that changes
362
*/
363
#define HA_REQUIRES_KEY_COLUMNS_FOR_DELETE (1 << 6)
364
#define HA_NULL_IN_KEY         (1 << 7) /* One can have keys with NULL */
365
#define HA_DUPLICATE_POS       (1 << 8)    /* ha_position() gives dup row */
366
#define HA_NO_BLOBS            (1 << 9) /* Doesn't support blobs */
367
#define HA_CAN_INDEX_BLOBS     (1 << 10)
368
#define HA_AUTO_PART_KEY       (1 << 11) /* auto-increment in multi-part key */
369
#define HA_REQUIRE_PRIMARY_KEY (1 << 12) /* .. and can't create a hidden one */
370
#define HA_STATS_RECORDS_IS_EXACT (1 << 13) /* stats.records is exact */
371
/*
372
  If we get the primary key columns for free when we do an index read
373
  It also implies that we have to retrive the primary key when using
374
  position() and rnd_pos().
375
*/
376
#define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)
377
/*
378
  If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position()
379
  uses a primary key. Without primary key, we can't call position().
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
380
*/
381
#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1 << 16)
520.8.6 by Monty Taylor
Removed handler from common_includes.
382
#define HA_NOT_DELETE_WITH_CACHE (1 << 18)
383
/*
384
  The following is we need to a primary key to delete (and update) a row.
385
  If there is no primary key, all columns needs to be read on update and delete
386
*/
387
#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE (1 << 19)
388
#define HA_NO_PREFIX_CHAR_KEYS (1 << 20)
389
#define HA_NO_AUTO_INCREMENT   (1 << 23)
390
#define HA_HAS_CHECKSUM        (1 << 24)
391
#define HA_NEED_READ_RANGE_BUFFER (1 << 29) /* for read_multi_range */
392
#define HA_ANY_INDEX_MAY_BE_UNIQUE (1 << 30)
393
#define HA_HAS_RECORDS	       (INT64_C(1) << 32) /* records() gives exact count*/
394
#define HA_MRR_CANT_SORT       (INT64_C(1) << 34)
395
396
/* bits in index_flags(index_number) for what you can do with index */
397
#define HA_READ_NEXT            1       /* TODO really use this flag */
398
#define HA_READ_PREV            2       /* supports ::index_prev */
399
#define HA_READ_ORDER           4       /* index_next/prev follow sort order */
400
#define HA_READ_RANGE           8       /* can find all records in a range */
401
#define HA_ONLY_WHOLE_INDEX	16	/* Can't use part key searches */
402
#define HA_KEYREAD_ONLY         64	/* Support HA_EXTRA_KEYREAD */
403
/*
404
  Index scan will not return records in rowid order. Not guaranteed to be
405
  set for unordered (e.g. HASH) indexes.
406
*/
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
407
#define HA_KEY_SCAN_NOT_ROR     128
520.8.6 by Monty Taylor
Removed handler from common_includes.
408
#define HA_DO_INDEX_COND_PUSHDOWN  256 /* Supports Index Condition Pushdown */
409
410
/* operations for disable/enable indexes */
411
#define HA_KEY_SWITCH_NONUNIQ      0
412
#define HA_KEY_SWITCH_ALL          1
413
#define HA_KEY_SWITCH_NONUNIQ_SAVE 2
414
#define HA_KEY_SWITCH_ALL_SAVE     3
415
416
/*
417
  Note: the following includes binlog and closing 0.
418
  so: innodb + bdb + ndb + binlog + myisam + myisammrg + archive +
419
      example + csv + heap + blackhole + federated + 0
420
  (yes, the sum is deliberately inaccurate)
421
  TODO remove the limit, use dynarrays
422
*/
423
#define MAX_HA 15
424
425
/*
426
  Parameters for open() (in register form->filestat)
427
  HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED
428
*/
429
430
#define HA_OPEN_KEYFILE		1
431
#define HA_OPEN_RNDFILE		2
432
#define HA_GET_INDEX		4
433
#define HA_GET_INFO		8	/* do a ha_info() after open */
434
#define HA_READ_ONLY		16	/* File opened as readonly */
435
/* Try readonly if can't open with read and write */
436
#define HA_TRY_READ_ONLY	32
437
#define HA_WAIT_IF_LOCKED	64	/* Wait if locked on open */
438
#define HA_ABORT_IF_LOCKED	128	/* skip if locked on open.*/
439
#define HA_BLOCK_LOCK		256	/* unlock when reading some records */
440
#define HA_OPEN_TEMPORARY	512
441
442
/* For transactional LOCK Table. handler::lock_table() */
443
#define HA_LOCK_IN_SHARE_MODE      F_RDLCK
444
#define HA_LOCK_IN_EXCLUSIVE_MODE  F_WRLCK
445
446
/* Some key definitions */
447
#define HA_KEY_NULL_LENGTH	1
448
#define HA_KEY_BLOB_LENGTH	2
449
450
#define HA_LEX_CREATE_TMP_TABLE	1
451
#define HA_LEX_CREATE_IF_NOT_EXISTS 2
452
#define HA_LEX_CREATE_TABLE_LIKE 4
453
#define HA_OPTION_NO_CHECKSUM	(1L << 17)
454
#define HA_MAX_REC_LENGTH	65535
455
456
/* Options of START TRANSACTION statement (and later of SET TRANSACTION stmt) */
1206.1.3 by Brian Aker
Valgrind fix for startTransaction()
457
enum start_transaction_option_t
458
{
459
  START_TRANS_NO_OPTIONS,
460
  START_TRANS_OPT_WITH_CONS_SNAPSHOT
461
};
520.8.6 by Monty Taylor
Removed handler from common_includes.
462
463
/* Flags for method is_fatal_error */
464
#define HA_CHECK_DUP_KEY 1
465
#define HA_CHECK_DUP_UNIQUE 2
466
#define HA_CHECK_DUP (HA_CHECK_DUP_KEY + HA_CHECK_DUP_UNIQUE)
467
468
469
/* Bits in used_fields */
470
#define HA_CREATE_USED_AUTO             (1L << 0)
471
#define HA_CREATE_USED_CHARSET          (1L << 8)
472
#define HA_CREATE_USED_DEFAULT_CHARSET  (1L << 9)
473
#define HA_CREATE_USED_ENGINE           (1L << 12)
474
#define HA_CREATE_USED_ROW_FORMAT       (1L << 15)
475
#define HA_CREATE_USED_COMMENT          (1L << 16)
476
#define HA_CREATE_USED_KEY_BLOCK_SIZE   (1L << 19)
477
#define HA_CREATE_USED_BLOCK_SIZE       (1L << 22)
478
479
#define MAXGTRIDSIZE 64
480
#define MAXBQUALSIZE 64
481
482
/*
483
  The below two are not used (and not handled) in this milestone of this WL
484
  entry because there seems to be no use for them at this stage of
485
  implementation.
486
*/
487
#define HA_MRR_SINGLE_POINT 1
488
#define HA_MRR_FIXED_KEY  2
489
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
490
/*
520.8.6 by Monty Taylor
Removed handler from common_includes.
491
  Indicates that RANGE_SEQ_IF::next(&range) doesn't need to fill in the
492
  'range' parameter.
493
*/
494
#define HA_MRR_NO_ASSOCIATION 4
495
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
496
/*
520.8.6 by Monty Taylor
Removed handler from common_includes.
497
  The MRR user will provide ranges in key order, and MRR implementation
498
  must return rows in key order.
499
*/
500
#define HA_MRR_SORTED 8
501
502
/* MRR implementation doesn't have to retrieve full records */
503
#define HA_MRR_INDEX_ONLY 16
504
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
505
/*
520.8.6 by Monty Taylor
Removed handler from common_includes.
506
  The passed memory buffer is of maximum possible size, the caller can't
507
  assume larger buffer.
508
*/
509
#define HA_MRR_LIMITS 32
510
511
512
/*
513
  Flag set <=> default MRR implementation is used
514
  (The choice is made by **_info[_const]() function which may set this
515
   flag. SQL layer remembers the flag value and then passes it to
516
   multi_read_range_init().
517
*/
518
#define HA_MRR_USE_DEFAULT_IMPL 64
519
520
/*
521
  Used only as parameter to multi_range_read_info():
522
  Flag set <=> the caller guarantees that the bounds of the scanned ranges
523
  will not have NULL values.
524
*/
525
#define HA_MRR_NO_NULL_ENDPOINTS 128
526
575.1.6 by Monty Taylor
Cleaned up some headers for PCH.
527
typedef int myf;
528
#define MYF(v)		(myf) (v)
529
584.1.1 by Monty Taylor
Moved an enum def to fix Lee's problem.
530
#define MY_I_S_MAYBE_NULL 1
531
#define MY_I_S_UNSIGNED   2
532
533
534
#define SKIP_OPEN_TABLE 0                // do not open table
535
#define OPEN_FRM_ONLY   1                // open FRM file only
536
#define OPEN_FULL_TABLE 2                // open FRM,MYD, MYI files
537
584.4.1 by Monty Taylor
Split out DTCollation.
538
/*
539
   "Declared Type Collation"
540
   A combination of collation and its derivation.
541
542
  Flags for collation aggregation modes:
543
  MY_COLL_ALLOW_SUPERSET_CONV  - allow conversion to a superset
544
  MY_COLL_ALLOW_COERCIBLE_CONV - allow conversion of a coercible value
545
                                 (i.e. constant).
546
  MY_COLL_ALLOW_CONV           - allow any kind of conversion
547
                                 (combination of the above two)
548
  MY_COLL_DISALLOW_NONE        - don't allow return DERIVATION_NONE
549
                                 (e.g. when aggregating for comparison)
550
  MY_COLL_CMP_CONV             - combination of MY_COLL_ALLOW_CONV
551
                                 and MY_COLL_DISALLOW_NONE
552
*/
553
554
#define MY_COLL_ALLOW_SUPERSET_CONV   1
555
#define MY_COLL_ALLOW_COERCIBLE_CONV  2
556
#define MY_COLL_ALLOW_CONV            3
557
#define MY_COLL_DISALLOW_NONE         4
558
#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.
559
#define clear_timestamp_auto_bits(_target_, _bits_) \
560
  (_target_)= (enum timestamp_auto_set_type)((int)(_target_) & ~(int)(_bits_))
561
584.5.1 by Monty Taylor
Removed field includes from field.h.
562
/*
563
 * The following are for the interface with the .frm file
564
 */
565
566
#define FIELDFLAG_PACK_SHIFT    3
567
#define FIELDFLAG_MAX_DEC    31
568
569
#define MTYP_TYPENR(type) (type & 127)  /* Remove bits from type */
570
571
#define f_packtype(x)   (((x) >> FIELDFLAG_PACK_SHIFT) & 15)
572
#define f_settype(x)    (((int) x) << FIELDFLAG_PACK_SHIFT)
1119.9.4 by Jay Pipes
Removes the FIELDFLAG_NO_DEFAULT bit and f_no_default macro and calls
573
574
#endif /* DRIZZLED_DEFINITIONS_H */