~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
26
#ifndef DRIZZLE_SERVER_DEFINITIONS_H
27
#define DRIZZLE_SERVER_DEFINITIONS_H
28
575.1.6 by Monty Taylor
Cleaned up some headers for PCH.
29
#include <stdint.h>
30
243.1.12 by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from
31
/* These paths are converted to other systems (WIN95) before use */
32
33
#define LANGUAGE	"english/"
34
#define TEMP_PREFIX	"MY"
35
#define LOG_PREFIX	"ML"
36
#define PROGDIR		"bin/"
37
549 by Monty Taylor
Took gettext.h out of header files.
38
#define ER(X) error_message((X))
243.1.12 by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from
39
40
#define LIBLEN FN_REFLEN-FN_LEN			/* Max l{ngd p} dev */
41
/* extra 4+4 bytes for slave tmp tables */
42
#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4)
43
#define MAX_ALIAS_NAME 256
44
#define MAX_FIELD_NAME 34			/* Max colum name length +2 */
45
#define MAX_SYS_VAR_LENGTH 32
46
#define MAX_KEY MAX_INDEXES                     /* Max used keys */
47
#define MAX_REF_PARTS 16			/* Max parts used as ref */
48
#define MAX_KEY_LENGTH 4096			/* max possible key */
49
#define MAX_KEY_LENGTH_DECIMAL_WIDTH 4          /* strlen("4096") */
50
#if SIZEOF_OFF_T > 4
51
#define MAX_REFLENGTH 8				/* Max length for record ref */
52
#else
53
#define MAX_REFLENGTH 4				/* Max length for record ref */
54
#endif
55
#define MAX_HOSTNAME  61			/* len+1 in mysql.user */
56
57
#define MAX_MBWIDTH		4		/* Max multibyte sequence */
58
#define MAX_FIELD_CHARLENGTH	255
59
#define MAX_FIELD_VARCHARLENGTH	65535
60
#define CONVERT_IF_BIGGER_TO_BLOB 512		/* Used for CREATE ... SELECT */
61
62
/* Max column width +1 */
63
#define MAX_FIELD_WIDTH		(MAX_FIELD_CHARLENGTH*MAX_MBWIDTH+1)
64
65
#define MAX_DATE_WIDTH		10	/* YYYY-MM-DD */
66
#define MAX_TIME_WIDTH		23	/* -DDDDDD HH:MM:SS.###### */
67
#define MAX_DATETIME_FULL_WIDTH 29	/* YYYY-MM-DD HH:MM:SS.###### AM */
68
#define MAX_DATETIME_WIDTH	19	/* YYYY-MM-DD HH:MM:SS */
69
#define MAX_DATETIME_COMPRESSED_WIDTH 14  /* YYYYMMDDHHMMSS */
70
71
#define MAX_TABLES	(sizeof(table_map)*8-3)	/* Max tables in join */
72
#define PARAM_TABLE_BIT	(((table_map) 1) << (sizeof(table_map)*8-3))
73
#define OUTER_REF_TABLE_BIT	(((table_map) 1) << (sizeof(table_map)*8-2))
74
#define RAND_TABLE_BIT	(((table_map) 1) << (sizeof(table_map)*8-1))
75
#define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \
76
                           RAND_TABLE_BIT)
77
#define MAX_FIELDS	4096			/* Limit in the .frm file */
78
79
#define MAX_SELECT_NESTING (sizeof(nesting_map)*8-1)
80
81
#define MAX_SORT_MEMORY (2048*1024-MALLOC_OVERHEAD)
82
#define MIN_SORT_MEMORY (32*1024-MALLOC_OVERHEAD)
83
84
/* Memory allocated when parsing a statement / saving a statement */
85
#define MEM_ROOT_BLOCK_SIZE       8192
86
#define MEM_ROOT_PREALLOC         8192
87
#define TRANS_MEM_ROOT_BLOCK_SIZE 4096
88
#define TRANS_MEM_ROOT_PREALLOC   4096
89
90
#define DEFAULT_ERROR_COUNT	64
91
#define EXTRA_RECORDS	10			/* Extra records in sort */
92
#define SCROLL_EXTRA	5			/* Extra scroll-rows. */
895 by Brian Aker
Completion (?) of uint conversion.
93
#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
94
#define FIELD_NR_MASK	16383			/* To get fieldnumber */
95
#define FERR		-1			/* Error from my_functions */
96
#define CREATE_MODE	0			/* Default mode on new files */
97
#define NAMES_SEP_CHAR	'\377'			/* Char to sep. names */
98
895 by Brian Aker
Completion (?) of uint conversion.
99
#define READ_RECORD_BUFFER	(uint32_t) (IO_SIZE*8) /* Pointer_buffer_size */
100
#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
101
102
#define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH)
103
#define ME_ERROR (ME_BELL+ME_OLDWIN+ME_NOREFRESH)
104
#define MYF_RW MYF(MY_WME+MY_NABP)		/* Vid my_read & my_write */
105
106
	/* Defines for use with openfrm, openprt and openfrd */
107
108
#define READ_ALL		1	/* openfrm: Read all parameters */
109
#define CHANGE_FRM		2	/* openfrm: open .frm as O_RDWR */
110
#define EXTRA_RECORD		8	/* Reservera plats f|r extra record */
111
#define DONT_GIVE_ERROR		256	/* Don't do frm_error on openfrm  */
112
#define DELAYED_OPEN		4096	/* Open table later */
113
/**
114
  This flag is used in function get_all_tables() which fills
115
  I_S tables with data which are retrieved from frm files and storage engine
116
  The flag means that we need to open FRM file only to get necessary data.
117
*/
118
#define OPEN_FRM_FILE_ONLY     32768
119
/**
120
  This flag is used in function get_all_tables() which fills
121
  I_S tables with data which are retrieved from frm files and storage engine
122
  The flag means that we need to process tables only to get necessary data.
123
  Views are not processed.
124
*/
125
#define OPEN_TABLE_ONLY        OPEN_FRM_FILE_ONLY*2
126
/**
127
  This flag is used in function get_all_tables() which fills
128
  I_S tables with data which are retrieved from frm files and storage engine.
129
  The flag means that I_S table uses optimization algorithm.
130
*/
357 by Brian Aker
flag cleanup
131
#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
132
133
/*
134
  Minimum length pattern before Turbo Boyer-Moore is used
135
  for SELECT "text" LIKE "%pattern%", excluding the two
136
  wildcards in class Item_func_like.
137
*/
138
#define MIN_TURBOBM_PATTERN_LEN 3
139
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
140
/*
243.1.12 by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from
141
   Defines for binary logging.
142
   Do not decrease the value of BIN_LOG_HEADER_SIZE.
143
   Do not even increase it before checking code.
144
*/
145
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
146
#define BIN_LOG_HEADER_SIZE    4
243.1.12 by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from
147
148
#define DEFAULT_KEY_CACHE_NAME "default"
149
150
#define STORAGE_TYPE_MASK 7
151
#define COLUMN_FORMAT_MASK 7
152
#define COLUMN_FORMAT_SHIFT 3
153
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
154
/* Below are #defines that used to be in mysql_priv.h */
155
/***************************************************************************
156
  Configuration parameters
157
****************************************************************************/
158
#define MAX_PASSWORD_LENGTH	32
159
#define MAX_ACCEPT_RETRY	10	// Test accept this many times
160
#define MAX_FIELDS_BEFORE_HASH	32
161
#define USER_VARS_HASH_SIZE     16
162
#define TABLE_OPEN_CACHE_MIN    64
876 by Brian Aker
Removed some dead definitions.
163
#define TABLE_OPEN_CACHE_DEFAULT 1024
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
164
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
165
/*
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
166
 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:
167
 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
168
 100 bytes as reasonable buffer against growth and other environments'
169
 requirements.)
170
171
 Feel free to raise this by the smallest amount you can to get the
172
 "execution_constants" test to pass.
173
 */
174
#define STACK_MIN_SIZE          12000   ///< Abort if less stack during eval.
175
176
#define STACK_MIN_SIZE_FOR_OPEN 1024*80
177
#define STACK_BUFF_ALLOC        352     ///< For stack overrun checks
178
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
179
/**
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
180
 * @TODO Move into a drizzled.h since it's only used in drizzled.cc
181
 *
182
 * @TODO Rename to DRIZZLED_NET_RETRY_COUNT
183
 */
184
#ifndef MYSQLD_NET_RETRY_COUNT
185
#define MYSQLD_NET_RETRY_COUNT  10	///< Abort read after this many int.
186
#endif
187
#define TEMP_POOL_SIZE          128
188
189
#define QUERY_ALLOC_BLOCK_SIZE		8192
190
#define QUERY_ALLOC_PREALLOC_SIZE   	8192
191
#define TRANS_ALLOC_BLOCK_SIZE		4096
192
#define TRANS_ALLOC_PREALLOC_SIZE	4096
193
#define RANGE_ALLOC_BLOCK_SIZE		4096
194
#define UDF_ALLOC_BLOCK_SIZE		1024
195
#define TABLE_ALLOC_BLOCK_SIZE		1024
196
#define WARN_ALLOC_BLOCK_SIZE		2048
197
#define WARN_ALLOC_PREALLOC_SIZE	1024
198
#define PROFILE_ALLOC_BLOCK_SIZE  2048
199
#define PROFILE_ALLOC_PREALLOC_SIZE 1024
200
201
/*
202
  The following parameters is to decide when to use an extra cache to
203
  optimise seeks when reading a big table in sorted order
204
*/
205
#define MIN_FILE_LENGTH_TO_USE_ROW_CACHE (10L*1024*1024)
206
#define MIN_ROWS_TO_USE_TABLE_CACHE	 100
207
#define MIN_ROWS_TO_USE_BULK_INSERT	 100
208
209
/**
210
  The following is used to decide if MySQL should use table scanning
211
  instead of reading with keys.  The number says how many evaluation of the
212
  WHERE clause is comparable to reading one extra row from a table.
213
*/
214
#define TIME_FOR_COMPARE   5	// 5 compares == one read
215
216
/**
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
217
  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
218
  table.
219
*/
220
#define TIME_FOR_COMPARE_ROWID  (TIME_FOR_COMPARE*2)
221
222
/*
223
  For sequential disk seeks the cost formula is:
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
224
    DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST * #blocks_to_skip
225
226
  The cost of average seek
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
227
    DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST*BLOCKS_IN_AVG_SEEK =1.0.
228
*/
229
#define DISK_SEEK_BASE_COST ((double)0.9)
230
231
#define BLOCKS_IN_AVG_SEEK  128
232
233
#define DISK_SEEK_PROP_COST ((double)0.1/BLOCKS_IN_AVG_SEEK)
234
235
236
/**
237
  Number of rows in a reference table when refereed through a not unique key.
238
  This value is only used when we don't know anything about the key
239
  distribution.
240
*/
241
#define MATCHING_ROWS_IN_OTHER_TABLE 10
242
243
/** Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used). */
244
#define KEY_DEFAULT_PACK_LENGTH 8
245
246
/** Characters shown for the command in 'show processlist'. */
247
#define PROCESS_LIST_WIDTH 100
248
/* Characters shown for the command in 'information_schema.processlist' */
249
#define PROCESS_LIST_INFO_WIDTH 65535
250
251
#define PRECISION_FOR_DOUBLE 53
252
#define PRECISION_FOR_FLOAT  24
253
254
/*
255
  Default time to wait before aborting a new client connection
256
  that does not respond to "initial server greeting" timely
257
*/
258
#define CONNECT_TIMEOUT		10
259
260
/* The following can also be changed from the command line */
261
#define DEFAULT_CONCURRENCY	10
262
#define FLUSH_TIME		0		/**< Don't flush tables */
263
#define MAX_CONNECT_ERRORS	10		///< errors before disabling host
264
265
#define INTERRUPT_PRIOR 10
266
#define CONNECT_PRIOR	9
267
#define WAIT_PRIOR	8
268
#define QUERY_PRIOR	6
269
270
	/* Bits from testflag */
271
#define TEST_PRINT_CACHED_TABLES 1
272
#define TEST_NO_KEY_GROUP	 2
273
#define TEST_MIT_THREAD		4
274
#define TEST_KEEP_TMP_TABLES	16
275
#define TEST_READCHECK		64	/**< Force use of readcheck */
276
#define TEST_NO_EXTRA		128
277
#define TEST_CORE_ON_SIGNAL	256	/**< Give core if signal */
278
#define TEST_NO_STACKTRACE	512
279
#define TEST_SIGINT		1024	/**< Allow sigint on threads */
280
#define TEST_SYNCHRONIZATION    2048    /**< get server to do sleep in some places */
281
282
/* Bits for different SQL modes modes (including ANSI mode) */
361 by Brian Aker
One more mode down, two more left to go!
283
#define MODE_NO_ZERO_DATE		(2)
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
284
#define MODE_INVALID_DATES		(MODE_NO_ZERO_DATE*2)
285
286
/* @@optimizer_switch flags */
287
#define OPTIMIZER_SWITCH_NO_MATERIALIZATION 1
288
#define OPTIMIZER_SWITCH_NO_SEMIJOIN 2
289
290
#define MY_CHARSET_BIN_MB_MAXLEN 1
291
292
// uncachable cause
293
#define UNCACHEABLE_DEPENDENT   1
294
#define UNCACHEABLE_RAND        2
295
#define UNCACHEABLE_SIDEEFFECT	4
296
/// forcing to save JOIN for explain
297
#define UNCACHEABLE_EXPLAIN     8
298
/** Don't evaluate subqueries in prepare even if they're not correlated */
299
#define UNCACHEABLE_PREPARE    16
300
/* For uncorrelated SELECT in an UNION with some correlated SELECTs */
301
#define UNCACHEABLE_UNITED     32
302
303
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
304
#define UNDEF_POS (-1)
305
306
/* sql_show.cc:show_log_files() */
307
#define SHOW_LOG_STATUS_FREE "FREE"
308
#define SHOW_LOG_STATUS_INUSE "IN USE"
309
310
/* Options to add_table_to_list() */
311
#define TL_OPTION_UPDATING	1
312
#define TL_OPTION_FORCE_INDEX	2
313
#define TL_OPTION_IGNORE_LEAVES 4
314
#define TL_OPTION_ALIAS         8
315
316
/* Some portable defines */
317
318
#define portable_sizeof_char_ptr 8
319
584.2.1 by Stewart Smith
convert tmp_file_prefix to TMP_FILE_PREFIX to indicate it's a macro
320
#define TMP_FILE_PREFIX "#sql"			/**< Prefix for tmp tables */
321
#define TMP_FILE_PREFIX_LENGTH 4
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
322
323
/* Flags for calc_week() function.  */
324
#define WEEK_MONDAY_FIRST    1
325
#define WEEK_YEAR            2
326
#define WEEK_FIRST_WEEKDAY   4
327
574.3.17 by Lee
moving functions from item_timefunc to functions/time directory
328
/* used in date and time conversions */
329
/* Daynumber from year 0 to 9999-12-31 */
330
#define MAX_DAY_NUMBER 3652424L
331
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
332
#define STRING_BUFFER_USUAL_SIZE 80
333
334
/*
335
  Some defines for exit codes for ::is_equal class functions.
336
*/
337
#define IS_EQUAL_NO 0
338
#define IS_EQUAL_YES 1
339
#define IS_EQUAL_PACK_LENGTH 2
340
561.1.3 by Monty Taylor
Split some more things out of common_includes.h.
341
342
/**
343
  Query type constants.
344
345
  QT_ORDINARY -- ordinary SQL query.
346
  QT_IS -- SQL query to be shown in INFORMATION_SCHEMA (in utf8 and without
347
  character set introducers).
348
349
  @TODO
350
351
  Move this out of here once Stew's done with UDF breakout.  The following headers need it:
352
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
353
    sql_lex.h --> included by session.h
561.1.3 by Monty Taylor
Split some more things out of common_includes.h.
354
    item.h
355
    table.h
356
    item_func.h
357
    item_subselect.h
358
    item_timefunc.h
359
    item_sum.h
360
    item_cmpfunc.h
361
    item_strfunc.h
362
*/
363
enum enum_query_type
364
{
365
  QT_ORDINARY,
366
  QT_IS
367
};
368
369
370
/**
371
 * @TODO Move to a separate header?
372
 *
373
 * It's needed by item.h and field.h, which are both inter-dependent
374
 * and contain forward declarations of many structs/classes in the
375
 * other header file.
376
 *
377
 * What is needed is a separate header file that is included
378
 * by *both* item.h and field.h to resolve inter-dependencies
379
 *
380
 * But, probably want to hold off on this until Stew finished the UDF cleanup
381
 */
382
enum Derivation
383
{
384
  DERIVATION_IGNORABLE= 5,
385
  DERIVATION_COERCIBLE= 4,
386
  DERIVATION_SYSCONST= 3,
387
  DERIVATION_IMPLICIT= 2,
388
  DERIVATION_NONE= 1,
389
  DERIVATION_EXPLICIT= 0
390
};
391
392
/**
393
 * Opening modes for open_temporary_table and open_table_from_share
394
 *
395
 * @TODO Put this into an appropriate header. It is only needed in:
396
 *
397
 *    table.cc
398
 *    sql_base.cc
399
 */
400
enum open_table_mode
401
{
402
  OTM_OPEN= 0,
403
  OTM_CREATE= 1,
404
  OTM_ALTER= 2
405
};
406
407
enum enum_parsing_place
408
{
409
  NO_MATTER
410
  , IN_HAVING
411
  , SELECT_LIST
412
  , IN_WHERE
413
  , IN_ON
414
};
415
416
enum enum_mysql_completiontype {
417
  ROLLBACK_RELEASE= -2
418
  , ROLLBACK= 1
419
  , ROLLBACK_AND_CHAIN= 7
420
  , COMMIT_RELEASE= -1
421
  , COMMIT= 0
422
  , COMMIT_AND_CHAIN= 6
423
};
424
425
enum enum_check_fields
426
{
427
  CHECK_FIELD_IGNORE
428
  , CHECK_FIELD_WARN
429
  , CHECK_FIELD_ERROR_FOR_NULL
430
};
431
432
enum enum_var_type
433
{
434
  OPT_DEFAULT= 0
435
  , OPT_SESSION
436
  , OPT_GLOBAL
437
};
438
520.6.4 by Monty Taylor
Moved thr_lock.h out of common_includes.
439
553.1.2 by Monty Taylor
Moved some bitmap defines into bitmap.
440
typedef uint64_t query_id_t;
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
441
typedef void *range_seq_t;
442
520.6.7 by Monty Taylor
Moved a bunch of crap out of common_includes.
443
/* masks for start/stop operations on io and sql slave threads */
444
#define SLAVE_IO  1
445
#define SLAVE_SQL 2
446
520.8.6 by Monty Taylor
Removed handler from common_includes.
447
#ifndef NO_HASH
448
#define NO_HASH				/* Not yet implemented */
449
#endif
450
451
// the following is for checking tables
452
453
#define HA_ADMIN_ALREADY_DONE	  1
454
#define HA_ADMIN_OK               0
455
#define HA_ADMIN_NOT_IMPLEMENTED -1
456
#define HA_ADMIN_FAILED		 -2
457
#define HA_ADMIN_CORRUPT         -3
458
#define HA_ADMIN_INTERNAL_ERROR  -4
459
#define HA_ADMIN_INVALID         -5
460
#define HA_ADMIN_REJECT          -6
461
#define HA_ADMIN_TRY_ALTER       -7
462
#define HA_ADMIN_NEEDS_UPGRADE  -10
463
#define HA_ADMIN_NEEDS_ALTER    -11
464
#define HA_ADMIN_NEEDS_CHECK    -12
465
466
467
#define HA_ADD_INDEX                  (0)
468
#define HA_DROP_INDEX                 (1)
469
#define HA_ALTER_INDEX                (2)
470
#define HA_RENAME_INDEX               (3)
471
#define HA_ADD_UNIQUE_INDEX           (4)
472
#define HA_DROP_UNIQUE_INDEX          (5)
473
#define HA_ALTER_UNIQUE_INDEX         (6)
474
#define HA_RENAME_UNIQUE_INDEX        (7)
475
#define HA_ADD_PK_INDEX               (8)
476
#define HA_DROP_PK_INDEX              (9)
477
#define HA_ALTER_PK_INDEX             (10)
478
#define HA_ADD_COLUMN                 (11)
479
#define HA_DROP_COLUMN                (12)
480
#define HA_CHANGE_COLUMN              (13)
481
#define HA_ALTER_COLUMN_NAME          (14)
482
#define HA_ALTER_COLUMN_TYPE          (15)
483
#define HA_ALTER_COLUMN_ORDER         (16)
484
#define HA_ALTER_COLUMN_NULLABLE      (17)
485
#define HA_COLUMN_DEFAULT_VALUE       (18)
486
#define HA_COLUMN_STORAGE             (19)
487
#define HA_COLUMN_FORMAT              (20)
488
#define HA_ADD_FOREIGN_KEY            (21)
489
#define HA_DROP_FOREIGN_KEY           (22)
490
#define HA_ALTER_FOREIGN_KEY          (23)
491
#define HA_ADD_CONSTRAINT             (24)
492
#define HA_CHANGE_CHARACTER_SET       (30)
493
#define HA_SET_DEFAULT_CHARACTER_SET  (31)
494
#define HA_CHANGE_AUTOINCREMENT_VALUE (32)
495
#define HA_ALTER_STORAGE              (33)
496
#define HA_ALTER_TABLESPACE           (34)
497
#define HA_ALTER_ROW_FORMAT           (35)
498
#define HA_RENAME_TABLE               (36)
499
#define HA_ALTER_STORAGE_ENGINE       (37)
500
#define HA_RECREATE                   (38)
501
/* Remember to increase HA_MAX_ALTER_FLAGS when adding more flags! */
502
503
/* Return values for check_if_supported_alter */
504
505
#define HA_ALTER_ERROR               -1
506
#define HA_ALTER_SUPPORTED_WAIT_LOCK  0
507
#define HA_ALTER_SUPPORTED_NO_LOCK    1
508
#define HA_ALTER_NOT_SUPPORTED        2
509
510
/* Bits in table_flags() to show what database can do */
511
512
#define HA_NO_TRANSACTIONS     (1 << 0) /* Doesn't support transactions */
513
#define HA_PARTIAL_COLUMN_READ (1 << 1) /* read may not return all columns */
514
#define HA_TABLE_SCAN_ON_INDEX (1 << 2) /* No separate data/index file */
515
/*
516
  The following should be set if the following is not true when scanning
517
  a table with rnd_next()
518
  - We will see all rows (including deleted ones)
519
  - Row positions are 'table->s->db_record_offset' apart
520
  If this flag is not set, filesort will do a postion() call for each matched
521
  row to be able to find the row later.
522
*/
523
#define HA_REC_NOT_IN_SEQ      (1 << 3)
524
525
/*
526
  Reading keys in random order is as fast as reading keys in sort order
527
  (Used in records.cc to decide if we should use a record cache and by
528
  filesort to decide if we should sort key + data or key + pointer-to-row
529
*/
530
#define HA_FAST_KEY_READ       (1 << 5)
531
/*
532
  Set the following flag if we on delete should force all key to be read
533
  and on update read all keys that changes
534
*/
535
#define HA_REQUIRES_KEY_COLUMNS_FOR_DELETE (1 << 6)
536
#define HA_NULL_IN_KEY         (1 << 7) /* One can have keys with NULL */
537
#define HA_DUPLICATE_POS       (1 << 8)    /* ha_position() gives dup row */
538
#define HA_NO_BLOBS            (1 << 9) /* Doesn't support blobs */
539
#define HA_CAN_INDEX_BLOBS     (1 << 10)
540
#define HA_AUTO_PART_KEY       (1 << 11) /* auto-increment in multi-part key */
541
#define HA_REQUIRE_PRIMARY_KEY (1 << 12) /* .. and can't create a hidden one */
542
#define HA_STATS_RECORDS_IS_EXACT (1 << 13) /* stats.records is exact */
543
/*
544
  If we get the primary key columns for free when we do an index read
545
  It also implies that we have to retrive the primary key when using
546
  position() and rnd_pos().
547
*/
548
#define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)
549
/*
550
  If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position()
551
  uses a primary key. Without primary key, we can't call position().
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
552
*/
553
#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1 << 16)
520.8.6 by Monty Taylor
Removed handler from common_includes.
554
#define HA_NOT_DELETE_WITH_CACHE (1 << 18)
555
/*
556
  The following is we need to a primary key to delete (and update) a row.
557
  If there is no primary key, all columns needs to be read on update and delete
558
*/
559
#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE (1 << 19)
560
#define HA_NO_PREFIX_CHAR_KEYS (1 << 20)
561
#define HA_NO_AUTO_INCREMENT   (1 << 23)
562
#define HA_HAS_CHECKSUM        (1 << 24)
563
/* Table data are stored in separate files (for lower_case_table_names) */
564
#define HA_FILE_BASED	       (1 << 26)
565
#define HA_NEED_READ_RANGE_BUFFER (1 << 29) /* for read_multi_range */
566
#define HA_ANY_INDEX_MAY_BE_UNIQUE (1 << 30)
567
#define HA_HAS_RECORDS	       (INT64_C(1) << 32) /* records() gives exact count*/
568
#define HA_MRR_CANT_SORT       (INT64_C(1) << 34)
569
570
/* bits in index_flags(index_number) for what you can do with index */
571
#define HA_READ_NEXT            1       /* TODO really use this flag */
572
#define HA_READ_PREV            2       /* supports ::index_prev */
573
#define HA_READ_ORDER           4       /* index_next/prev follow sort order */
574
#define HA_READ_RANGE           8       /* can find all records in a range */
575
#define HA_ONLY_WHOLE_INDEX	16	/* Can't use part key searches */
576
#define HA_KEYREAD_ONLY         64	/* Support HA_EXTRA_KEYREAD */
577
/*
578
  Index scan will not return records in rowid order. Not guaranteed to be
579
  set for unordered (e.g. HASH) indexes.
580
*/
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
581
#define HA_KEY_SCAN_NOT_ROR     128
520.8.6 by Monty Taylor
Removed handler from common_includes.
582
#define HA_DO_INDEX_COND_PUSHDOWN  256 /* Supports Index Condition Pushdown */
583
584
/* operations for disable/enable indexes */
585
#define HA_KEY_SWITCH_NONUNIQ      0
586
#define HA_KEY_SWITCH_ALL          1
587
#define HA_KEY_SWITCH_NONUNIQ_SAVE 2
588
#define HA_KEY_SWITCH_ALL_SAVE     3
589
590
/*
591
  Note: the following includes binlog and closing 0.
592
  so: innodb + bdb + ndb + binlog + myisam + myisammrg + archive +
593
      example + csv + heap + blackhole + federated + 0
594
  (yes, the sum is deliberately inaccurate)
595
  TODO remove the limit, use dynarrays
596
*/
597
#define MAX_HA 15
598
599
/*
600
  Parameters for open() (in register form->filestat)
601
  HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED
602
*/
603
604
#define HA_OPEN_KEYFILE		1
605
#define HA_OPEN_RNDFILE		2
606
#define HA_GET_INDEX		4
607
#define HA_GET_INFO		8	/* do a ha_info() after open */
608
#define HA_READ_ONLY		16	/* File opened as readonly */
609
/* Try readonly if can't open with read and write */
610
#define HA_TRY_READ_ONLY	32
611
#define HA_WAIT_IF_LOCKED	64	/* Wait if locked on open */
612
#define HA_ABORT_IF_LOCKED	128	/* skip if locked on open.*/
613
#define HA_BLOCK_LOCK		256	/* unlock when reading some records */
614
#define HA_OPEN_TEMPORARY	512
615
616
/* For transactional LOCK Table. handler::lock_table() */
617
#define HA_LOCK_IN_SHARE_MODE      F_RDLCK
618
#define HA_LOCK_IN_EXCLUSIVE_MODE  F_WRLCK
619
620
/* Some key definitions */
621
#define HA_KEY_NULL_LENGTH	1
622
#define HA_KEY_BLOB_LENGTH	2
623
624
#define HA_LEX_CREATE_TMP_TABLE	1
625
#define HA_LEX_CREATE_IF_NOT_EXISTS 2
626
#define HA_LEX_CREATE_TABLE_LIKE 4
627
#define HA_OPTION_NO_CHECKSUM	(1L << 17)
628
#define HA_OPTION_NO_DELAY_KEY_WRITE (1L << 18)
629
#define HA_MAX_REC_LENGTH	65535
630
631
/* Options of START TRANSACTION statement (and later of SET TRANSACTION stmt) */
632
#define DRIZZLE_START_TRANS_OPT_WITH_CONS_SNAPSHOT 1
633
634
/* Flags for method is_fatal_error */
635
#define HA_CHECK_DUP_KEY 1
636
#define HA_CHECK_DUP_UNIQUE 2
637
#define HA_CHECK_DUP (HA_CHECK_DUP_KEY + HA_CHECK_DUP_UNIQUE)
638
639
enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
640
		ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED,
641
		ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT, ROW_TYPE_PAGE };
642
643
enum column_format_type { COLUMN_FORMAT_TYPE_NOT_USED= -1,
644
                          COLUMN_FORMAT_TYPE_DEFAULT=   0,
645
                          COLUMN_FORMAT_TYPE_FIXED=     1,
646
                          COLUMN_FORMAT_TYPE_DYNAMIC=   2 };
647
648
/* struct to hold information about the table that should be created */
649
650
/* Bits in used_fields */
651
#define HA_CREATE_USED_AUTO             (1L << 0)
652
#ifdef DEAD_OPTIONS
653
#define HA_CREATE_USED_UNION            (1L << 2)
654
#define HA_CREATE_USED_PASSWORD         (1L << 17)
655
#endif
656
#define HA_CREATE_USED_INSERT_METHOD    (1L << 3)
657
#define HA_CREATE_USED_MIN_ROWS         (1L << 4)
658
#define HA_CREATE_USED_MAX_ROWS         (1L << 5)
659
#define HA_CREATE_USED_AVG_ROW_LENGTH   (1L << 6)
660
#define HA_CREATE_USED_PACK_KEYS        (1L << 7)
661
#define HA_CREATE_USED_CHARSET          (1L << 8)
662
#define HA_CREATE_USED_DEFAULT_CHARSET  (1L << 9)
663
#define HA_CREATE_USED_DATADIR          (1L << 10)
664
#define HA_CREATE_USED_INDEXDIR         (1L << 11)
665
#define HA_CREATE_USED_ENGINE           (1L << 12)
666
#define HA_CREATE_USED_CHECKSUM         (1L << 13)
667
#define HA_CREATE_USED_DELAY_KEY_WRITE  (1L << 14)
668
#define HA_CREATE_USED_ROW_FORMAT       (1L << 15)
669
#define HA_CREATE_USED_COMMENT          (1L << 16)
670
#define HA_CREATE_USED_CONNECTION       (1L << 18)
671
#define HA_CREATE_USED_KEY_BLOCK_SIZE   (1L << 19)
672
#define HA_CREATE_USED_PAGE_CHECKSUM    (1L << 21)
673
#define HA_CREATE_USED_BLOCK_SIZE       (1L << 22)
674
675
#define MAXGTRIDSIZE 64
676
#define MAXBQUALSIZE 64
677
678
enum ha_choice { HA_CHOICE_UNDEF, HA_CHOICE_NO, HA_CHOICE_YES };
679
680
/*
681
  The below two are not used (and not handled) in this milestone of this WL
682
  entry because there seems to be no use for them at this stage of
683
  implementation.
684
*/
685
#define HA_MRR_SINGLE_POINT 1
686
#define HA_MRR_FIXED_KEY  2
687
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
688
/*
520.8.6 by Monty Taylor
Removed handler from common_includes.
689
  Indicates that RANGE_SEQ_IF::next(&range) doesn't need to fill in the
690
  'range' parameter.
691
*/
692
#define HA_MRR_NO_ASSOCIATION 4
693
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
694
/*
520.8.6 by Monty Taylor
Removed handler from common_includes.
695
  The MRR user will provide ranges in key order, and MRR implementation
696
  must return rows in key order.
697
*/
698
#define HA_MRR_SORTED 8
699
700
/* MRR implementation doesn't have to retrieve full records */
701
#define HA_MRR_INDEX_ONLY 16
702
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
703
/*
520.8.6 by Monty Taylor
Removed handler from common_includes.
704
  The passed memory buffer is of maximum possible size, the caller can't
705
  assume larger buffer.
706
*/
707
#define HA_MRR_LIMITS 32
708
709
710
/*
711
  Flag set <=> default MRR implementation is used
712
  (The choice is made by **_info[_const]() function which may set this
713
   flag. SQL layer remembers the flag value and then passes it to
714
   multi_read_range_init().
715
*/
716
#define HA_MRR_USE_DEFAULT_IMPL 64
717
718
/*
719
  Used only as parameter to multi_range_read_info():
720
  Flag set <=> the caller guarantees that the bounds of the scanned ranges
721
  will not have NULL values.
722
*/
723
#define HA_MRR_NO_NULL_ENDPOINTS 128
724
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
725
enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME };
726
727
enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED,
728
                         ISO_REPEATABLE_READ, ISO_SERIALIZABLE};
729
730
575.1.5 by Monty Taylor
Moved stuff to handlerton.cc
731
enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED};
732
575.1.6 by Monty Taylor
Cleaned up some headers for PCH.
733
typedef int myf;
734
#define MYF(v)		(myf) (v)
735
575.4.7 by Monty Taylor
More header cleanup.
736
/*
737
  When a command is added here, be sure it's also added in mysqld.cc
738
  in "struct show_var_st status_vars[]= {" ...
739
740
  If the command returns a result set or is not allowed in stored
741
  functions or triggers, please also make sure that
742
  sp_get_flags_for_command (sp_head.cc) returns proper flags for the
743
  added SQLCOM_.
744
*/
745
746
enum enum_sql_command {
747
  SQLCOM_SELECT, SQLCOM_CREATE_TABLE, SQLCOM_CREATE_INDEX, SQLCOM_ALTER_TABLE,
748
  SQLCOM_UPDATE, SQLCOM_INSERT, SQLCOM_INSERT_SELECT,
749
  SQLCOM_DELETE, SQLCOM_TRUNCATE, SQLCOM_DROP_TABLE, SQLCOM_DROP_INDEX,
750
  SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
751
  SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_STATUS,
752
  SQLCOM_SHOW_ENGINE_LOGS, SQLCOM_SHOW_ENGINE_STATUS, SQLCOM_SHOW_ENGINE_MUTEX,
798.2.10 by Brian Aker
Remove COM bits for replication
753
  SQLCOM_SHOW_PROCESSLIST,
575.4.7 by Monty Taylor
More header cleanup.
754
  SQLCOM_SHOW_CREATE,
755
  SQLCOM_SHOW_CREATE_DB,
756
  SQLCOM_SHOW_TABLE_STATUS,
757
  SQLCOM_LOAD,SQLCOM_SET_OPTION,SQLCOM_LOCK_TABLES,SQLCOM_UNLOCK_TABLES,
758
  SQLCOM_CHANGE_DB, SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB,
759
  SQLCOM_REPAIR, SQLCOM_REPLACE, SQLCOM_REPLACE_SELECT,
760
  SQLCOM_OPTIMIZE, SQLCOM_CHECK,
761
  SQLCOM_ASSIGN_TO_KEYCACHE,
762
  SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_ANALYZE,
763
  SQLCOM_ROLLBACK, SQLCOM_ROLLBACK_TO_SAVEPOINT,
764
  SQLCOM_COMMIT, SQLCOM_SAVEPOINT, SQLCOM_RELEASE_SAVEPOINT,
765
  SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP,
798.2.10 by Brian Aker
Remove COM bits for replication
766
  SQLCOM_BEGIN,
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
767
  SQLCOM_RENAME_TABLE,
575.4.7 by Monty Taylor
More header cleanup.
768
  SQLCOM_SHOW_OPEN_TABLES,
769
  SQLCOM_DELETE_MULTI, SQLCOM_UPDATE_MULTI,
770
  SQLCOM_SHOW_WARNS,
771
  SQLCOM_EMPTY_QUERY,
772
  SQLCOM_SHOW_ERRORS,
773
  SQLCOM_CHECKSUM,
774
  SQLCOM_SHOW_PLUGINS,
775
  /*
776
    When a command is added here, be sure it's also added in mysqld.cc
777
    in "struct show_var_st status_vars[]= {" ...
778
  */
779
  /* This should be the last !!! */
780
  SQLCOM_END
781
};
782
783
enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_UPDATE };
784
584.1.1 by Monty Taylor
Moved an enum def to fix Lee's problem.
785
/*
786
  Make sure that the order of schema_tables and enum_schema_tables are the same.
787
*/
788
789
enum enum_schema_tables
790
{
791
  SCH_CHARSETS= 0,
792
  SCH_COLLATIONS,
793
  SCH_COLLATION_CHARACTER_SET_APPLICABILITY,
794
  SCH_COLUMNS,
795
  SCH_GLOBAL_STATUS,
796
  SCH_GLOBAL_VARIABLES,
797
  SCH_KEY_COLUMN_USAGE,
798
  SCH_OPEN_TABLES,
799
  SCH_PLUGINS,
800
  SCH_PROCESSLIST,
801
  SCH_REFERENTIAL_CONSTRAINTS,
802
  SCH_SCHEMATA,
803
  SCH_SESSION_STATUS,
804
  SCH_SESSION_VARIABLES,
805
  SCH_STATISTICS,
806
  SCH_STATUS,
807
  SCH_TABLES,
808
  SCH_TABLE_CONSTRAINTS,
809
  SCH_TABLE_NAMES,
810
  SCH_VARIABLES
811
};
812
813
814
#define MY_I_S_MAYBE_NULL 1
815
#define MY_I_S_UNSIGNED   2
816
817
818
#define SKIP_OPEN_TABLE 0                // do not open table
819
#define OPEN_FRM_ONLY   1                // open FRM file only
820
#define OPEN_FULL_TABLE 2                // open FRM,MYD, MYI files
821
584.4.1 by Monty Taylor
Split out DTCollation.
822
/*
823
   "Declared Type Collation"
824
   A combination of collation and its derivation.
825
826
  Flags for collation aggregation modes:
827
  MY_COLL_ALLOW_SUPERSET_CONV  - allow conversion to a superset
828
  MY_COLL_ALLOW_COERCIBLE_CONV - allow conversion of a coercible value
829
                                 (i.e. constant).
830
  MY_COLL_ALLOW_CONV           - allow any kind of conversion
831
                                 (combination of the above two)
832
  MY_COLL_DISALLOW_NONE        - don't allow return DERIVATION_NONE
833
                                 (e.g. when aggregating for comparison)
834
  MY_COLL_CMP_CONV             - combination of MY_COLL_ALLOW_CONV
835
                                 and MY_COLL_DISALLOW_NONE
836
*/
837
838
#define MY_COLL_ALLOW_SUPERSET_CONV   1
839
#define MY_COLL_ALLOW_COERCIBLE_CONV  2
840
#define MY_COLL_ALLOW_CONV            3
841
#define MY_COLL_DISALLOW_NONE         4
842
#define MY_COLL_CMP_CONV              7
843
584.1.1 by Monty Taylor
Moved an enum def to fix Lee's problem.
844
584.1.13 by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes.
845
enum tmp_table_type
846
{
847
  NO_TMP_TABLE, NON_TRANSACTIONAL_TMP_TABLE, TRANSACTIONAL_TMP_TABLE,
848
  INTERNAL_TMP_TABLE, SYSTEM_TMP_TABLE, TMP_TABLE_FRM_FILE_ONLY
849
};
850
851
/*
852
  Values in this enum are used to indicate how a tables TIMESTAMP field
853
  should be treated. It can be set to the current timestamp on insert or
854
  update or both.
855
  WARNING: The values are used for bit operations. If you change the
856
  enum, you must keep the bitwise relation of the values. For example:
857
  (int) TIMESTAMP_AUTO_SET_ON_BOTH must be equal to
858
  (int) TIMESTAMP_AUTO_SET_ON_INSERT | (int) TIMESTAMP_AUTO_SET_ON_UPDATE.
859
  We use an enum here so that the debugger can display the value names.
860
*/
861
enum timestamp_auto_set_type
862
{
863
  TIMESTAMP_NO_AUTO_SET= 0, TIMESTAMP_AUTO_SET_ON_INSERT= 1,
864
  TIMESTAMP_AUTO_SET_ON_UPDATE= 2, TIMESTAMP_AUTO_SET_ON_BOTH= 3
865
};
866
#define clear_timestamp_auto_bits(_target_, _bits_) \
867
  (_target_)= (enum timestamp_auto_set_type)((int)(_target_) & ~(int)(_bits_))
868
869
/**
870
  Category of table found in the table share.
871
*/
872
enum enum_table_category
873
{
874
  /**
875
    Unknown value.
876
  */
877
  TABLE_UNKNOWN_CATEGORY=0,
878
879
  /**
880
    Temporary table.
881
    The table is visible only in the session.
882
    Therefore,
883
    - FLUSH TABLES WITH READ LOCK
884
    - SET GLOBAL READ_ONLY = ON
885
    do not apply to this table.
886
    Note that LOCK Table t FOR READ/WRITE
887
    can be used on temporary tables.
888
    Temporary tables are not part of the table cache.
889
  */
890
  TABLE_CATEGORY_TEMPORARY=1,
891
892
  /**
893
    User table.
894
    These tables do honor:
895
    - LOCK Table t FOR READ/WRITE
896
    - FLUSH TABLES WITH READ LOCK
897
    - SET GLOBAL READ_ONLY = ON
898
    User tables are cached in the table cache.
899
  */
900
  TABLE_CATEGORY_USER=2,
901
902
  /**
903
    Information schema tables.
904
    These tables are an interface provided by the system
905
    to inspect the system metadata.
906
    These tables do *not* honor:
907
    - LOCK Table t FOR READ/WRITE
908
    - FLUSH TABLES WITH READ LOCK
909
    - SET GLOBAL READ_ONLY = ON
910
    as there is no point in locking explicitely
911
    an INFORMATION_SCHEMA table.
912
    Nothing is directly written to information schema tables.
913
    Note that this value is not used currently,
914
    since information schema tables are not shared,
915
    but implemented as session specific temporary tables.
916
  */
917
  /*
918
    TODO: Fixing the performance issues of I_S will lead
919
    to I_S tables in the table cache, which should use
920
    this table type.
921
  */
922
  TABLE_CATEGORY_INFORMATION
923
};
924
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
925
enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
926
enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON,
927
                            DELAY_KEY_WRITE_ALL };
928
enum enum_mark_columns
929
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
930
931
enum enum_filetype { FILETYPE_CSV, FILETYPE_XML };
932
933
enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND,
934
                                  IGNORE_ERRORS, REPORT_EXCEPT_NON_UNIQUE,
935
                                  IGNORE_EXCEPT_NON_UNIQUE};
936
937
enum enum_schema_table_state
938
{
939
  NOT_PROCESSED= 0,
940
  PROCESSED_BY_CREATE_SORT_INDEX,
941
  PROCESSED_BY_JOIN_EXEC
942
};
943
584.5.1 by Monty Taylor
Removed field includes from field.h.
944
/*
945
 * The following are for the interface with the .frm file
946
 */
947
948
#define FIELDFLAG_DECIMAL    1
949
#define FIELDFLAG_BINARY    1  // Shares same flag
950
#define FIELDFLAG_NUMBER    2
951
#define FIELDFLAG_DECIMAL_POSITION      4
952
#define FIELDFLAG_PACK      120  // Bits used for packing
953
#define FIELDFLAG_INTERVAL    256     // mangled with decimals!
954
#define FIELDFLAG_BLOB      1024  // mangled with decimals!
955
956
#define FIELDFLAG_NO_DEFAULT    16384   /* sql */
957
#define FIELDFLAG_SUM      ((uint32_t) 32768)// predit: +#fieldflag
958
#define FIELDFLAG_MAYBE_NULL    ((uint32_t) 32768)// sql
959
#define FIELDFLAG_HEX_ESCAPE    ((uint32_t) 0x10000)
960
#define FIELDFLAG_PACK_SHIFT    3
961
#define FIELDFLAG_DEC_SHIFT    8
962
#define FIELDFLAG_MAX_DEC    31
963
964
#define MTYP_TYPENR(type) (type & 127)  /* Remove bits from type */
965
966
#define f_is_dec(x)     ((x) & FIELDFLAG_DECIMAL)
967
#define f_is_num(x)     ((x) & FIELDFLAG_NUMBER)
968
#define f_is_decimal_precision(x)  ((x) & FIELDFLAG_DECIMAL_POSITION)
969
#define f_is_packed(x)  ((x) & FIELDFLAG_PACK)
970
#define f_packtype(x)   (((x) >> FIELDFLAG_PACK_SHIFT) & 15)
971
#define f_decimals(x)   ((uint8_t) (((x) >> FIELDFLAG_DEC_SHIFT) & \
972
                                     FIELDFLAG_MAX_DEC))
973
#define f_is_alpha(x)   (!f_is_num(x))
974
#define f_is_binary(x)  ((x) & FIELDFLAG_BINARY) // 4.0- compatibility
975
#define f_is_enum(x)    (((x) & (FIELDFLAG_INTERVAL | FIELDFLAG_NUMBER)) == \
976
                         FIELDFLAG_INTERVAL)
977
#define f_is_blob(x)    (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == \
978
                         FIELDFLAG_BLOB)
979
#define f_is_equ(x)     ((x) & (1+2+FIELDFLAG_PACK+31*256))
980
#define f_settype(x)    (((int) x) << FIELDFLAG_PACK_SHIFT)
981
#define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL)
982
#define f_no_default(x) (x & FIELDFLAG_NO_DEFAULT)
983
#define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE)
984
243.1.12 by Jay Pipes
* Added drizzled/definitions.h which contains many of the #defines from
985
#endif /* DRIZZLE_SERVER_DEFINITIONS_H */
575.4.7 by Monty Taylor
More header cleanup.
986