~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/definitions.h

  • Committer: Brian Aker
  • Date: 2008-09-12 06:42:41 UTC
  • mto: (322.2.8 stdize-code)
  • mto: This revision was merged to the branch mainline in revision 386.
  • Revision ID: brian@tangent.org-20080912064241-520utxq2078904l2
Remove 3 byte UTF8 collation

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 */
 
1
/* Copyright (C) 2000-2006 MySQL AB
 
2
 
 
3
   This program is free software; you can redistribute it and/or modify
 
4
   it under the terms of the GNU General Public License as published by
 
5
   the Free Software Foundation; version 2 of the License.
 
6
 
 
7
   This program is distributed in the hope that it will be useful,
 
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
   GNU General Public License for more details.
 
11
 
 
12
   You should have received a copy of the GNU General Public License
 
13
   along with this program; if not, write to the Free Software
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
19
16
 
20
17
/**
21
18
 * @file
22
19
 *
23
 
 * Mostly constants and some macros/functions used by the server
 
20
 * Mostly constants and some macros/functions used by the server  
24
21
 */
25
22
 
26
23
#ifndef DRIZZLE_SERVER_DEFINITIONS_H
27
24
#define DRIZZLE_SERVER_DEFINITIONS_H
28
25
 
29
 
#include <stdint.h>
30
 
 
31
26
#ifndef NO_ALARM_LOOP
32
27
#define NO_ALARM_LOOP           /* lib5 and popen can't use alarm */
33
28
#endif
39
34
#define TEMP_PREFIX     "MY"
40
35
#define LOG_PREFIX      "ML"
41
36
#define PROGDIR         "bin/"
42
 
 
43
 
#define ER(X) error_message((X))
44
 
 
 
37
#ifndef DATADIR
 
38
#define DATADIR         "data/"
 
39
#endif
 
40
#ifndef SHAREDIR
 
41
#define SHAREDIR        "share/"
 
42
#endif
 
43
#ifndef PLUGINDIR
 
44
#define PLUGINDIR       "lib/plugin"
 
45
#endif
 
46
 
 
47
#define ER(X) _(drizzled_error_messages[(X) - ER_ERROR_FIRST])
 
48
#define ER_SAFE(X) (((X) >= ER_ERROR_FIRST && (X) <= ER_ERROR_LAST) ? ER(X) : _("Invalid error code"))
 
49
 
 
50
#define ERRMAPP 1                               /* Errormap f|r my_error */
45
51
#define LIBLEN FN_REFLEN-FN_LEN                 /* Max l{ngd p} dev */
46
52
/* extra 4+4 bytes for slave tmp tables */
47
53
#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4)
98
104
#define EXTRA_RECORDS   10                      /* Extra records in sort */
99
105
#define SCROLL_EXTRA    5                       /* Extra scroll-rows. */
100
106
#define FIELD_NAME_USED ((uint) 32768)          /* Bit set if fieldname used */
 
107
#define FORM_NAME_USED  ((uint) 16384)          /* Bit set if formname used */
101
108
#define FIELD_NR_MASK   16383                   /* To get fieldnumber */
102
109
#define FERR            -1                      /* Error from my_functions */
103
110
#define CREATE_MODE     0                       /* Default mode on new files */
151
158
#define TE_INFO_LENGTH 3
152
159
#define MTYP_NOEMPTY_BIT 128
153
160
 
154
 
#define FRM_VER 6
155
161
#define FRM_VER_TRUE_VARCHAR (FRM_VER+4) /* 10 */
156
162
#define DRIZZLE_VERSION_TABLESPACE_IN_FRM_CGE 50120
157
163
#define DRIZZLE_VERSION_TABLESPACE_IN_FRM 50205
164
170
*/
165
171
#define MIN_TURBOBM_PATTERN_LEN 3
166
172
 
167
 
/*
 
173
/* 
168
174
   Defines for binary logging.
169
175
   Do not decrease the value of BIN_LOG_HEADER_SIZE.
170
176
   Do not even increase it before checking code.
171
177
*/
172
178
 
173
 
#define BIN_LOG_HEADER_SIZE    4
 
179
#define BIN_LOG_HEADER_SIZE    4 
174
180
 
175
181
#define DEFAULT_KEY_CACHE_NAME "default"
176
182
 
191
197
#define TABLE_OPEN_CACHE_MIN    64
192
198
#define TABLE_OPEN_CACHE_DEFAULT 64
193
199
 
194
 
/*
 
200
/* 
195
201
 Value of 9236 discovered through binary search 2006-09-26 on Ubuntu Dapper
196
 
 Drake, libc6 2.3.6-0ubuntu2, Linux kernel 2.6.15-27-686, on x86.  (Added
 
202
 Drake, libc6 2.3.6-0ubuntu2, Linux kernel 2.6.15-27-686, on x86.  (Added 
197
203
 100 bytes as reasonable buffer against growth and other environments'
198
204
 requirements.)
199
205
 
205
211
#define STACK_MIN_SIZE_FOR_OPEN 1024*80
206
212
#define STACK_BUFF_ALLOC        352     ///< For stack overrun checks
207
213
 
208
 
/**
 
214
/** 
209
215
 * @TODO Move into a drizzled.h since it's only used in drizzled.cc
210
216
 *
211
217
 * @TODO Rename to DRIZZLED_NET_RETRY_COUNT
245
251
#define TIME_FOR_COMPARE   5    // 5 compares == one read
246
252
 
247
253
/**
248
 
  Number of comparisons of table rowids equivalent to reading one row from a
 
254
  Number of comparisons of table rowids equivalent to reading one row from a 
249
255
  table.
250
256
*/
251
257
#define TIME_FOR_COMPARE_ROWID  (TIME_FOR_COMPARE*2)
252
258
 
253
259
/*
254
260
  For sequential disk seeks the cost formula is:
255
 
    DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST * #blocks_to_skip
256
 
 
257
 
  The cost of average seek
 
261
    DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST * #blocks_to_skip  
 
262
  
 
263
  The cost of average seek 
258
264
    DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST*BLOCKS_IN_AVG_SEEK =1.0.
259
265
*/
260
266
#define DISK_SEEK_BASE_COST ((double)0.9)
302
308
#define TEST_PRINT_CACHED_TABLES 1
303
309
#define TEST_NO_KEY_GROUP        2
304
310
#define TEST_MIT_THREAD         4
 
311
#define TEST_BLOCKING           8
305
312
#define TEST_KEEP_TMP_TABLES    16
306
313
#define TEST_READCHECK          64      /**< Force use of readcheck */
307
314
#define TEST_NO_EXTRA           128
309
316
#define TEST_NO_STACKTRACE      512
310
317
#define TEST_SIGINT             1024    /**< Allow sigint on threads */
311
318
#define TEST_SYNCHRONIZATION    2048    /**< get server to do sleep in some places */
 
319
#endif /* End ifndef DRIZZLE_CLIENT */
 
320
 
 
321
/* The rest of the file is included in the server only */
 
322
#ifndef DRIZZLE_CLIENT
312
323
 
313
324
/* Bits for different SQL modes modes (including ANSI mode) */
314
325
#define MODE_NO_ZERO_DATE               (2)
352
363
 
353
364
#define portable_sizeof_char_ptr 8
354
365
 
355
 
#define TMP_FILE_PREFIX "#sql"                  /**< Prefix for tmp tables */
356
 
#define TMP_FILE_PREFIX_LENGTH 4
 
366
#define tmp_file_prefix "#sql"                  /**< Prefix for tmp tables */
 
367
#define tmp_file_prefix_length 4
357
368
 
358
369
/* Flags for calc_week() function.  */
359
370
#define WEEK_MONDAY_FIRST    1
360
371
#define WEEK_YEAR            2
361
372
#define WEEK_FIRST_WEEKDAY   4
362
373
 
363
 
/* used in date and time conversions */
364
 
/* Daynumber from year 0 to 9999-12-31 */
365
 
#define MAX_DAY_NUMBER 3652424L
366
 
 
367
374
#define STRING_BUFFER_USUAL_SIZE 80
368
375
 
369
376
/*
374
381
#define IS_EQUAL_PACK_LENGTH 2
375
382
 
376
383
 
377
 
/**
378
 
  Query type constants.
379
 
 
380
 
  QT_ORDINARY -- ordinary SQL query.
381
 
  QT_IS -- SQL query to be shown in INFORMATION_SCHEMA (in utf8 and without
382
 
  character set introducers).
383
 
 
384
 
  @TODO
385
 
 
386
 
  Move this out of here once Stew's done with UDF breakout.  The following headers need it:
387
 
 
388
 
    sql_lex.h --> included by session.h
389
 
    item.h
390
 
    table.h
391
 
    item_func.h
392
 
    item_subselect.h
393
 
    item_timefunc.h
394
 
    item_sum.h
395
 
    item_cmpfunc.h
396
 
    item_strfunc.h
397
 
*/
398
 
enum enum_query_type
399
 
{
400
 
  QT_ORDINARY,
401
 
  QT_IS
402
 
};
403
 
 
404
 
 
405
 
/**
406
 
 * @TODO Move to a separate header?
407
 
 *
408
 
 * It's needed by item.h and field.h, which are both inter-dependent
409
 
 * and contain forward declarations of many structs/classes in the
410
 
 * other header file.
411
 
 *
412
 
 * What is needed is a separate header file that is included
413
 
 * by *both* item.h and field.h to resolve inter-dependencies
414
 
 *
415
 
 * But, probably want to hold off on this until Stew finished the UDF cleanup
416
 
 */
417
 
enum Derivation
418
 
{
419
 
  DERIVATION_IGNORABLE= 5,
420
 
  DERIVATION_COERCIBLE= 4,
421
 
  DERIVATION_SYSCONST= 3,
422
 
  DERIVATION_IMPLICIT= 2,
423
 
  DERIVATION_NONE= 1,
424
 
  DERIVATION_EXPLICIT= 0
425
 
};
426
 
 
427
 
/**
428
 
 * Opening modes for open_temporary_table and open_table_from_share
429
 
 *
430
 
 * @TODO Put this into an appropriate header. It is only needed in:
431
 
 *
432
 
 *    table.cc
433
 
 *    sql_base.cc
434
 
 */
435
 
enum open_table_mode
436
 
{
437
 
  OTM_OPEN= 0,
438
 
  OTM_CREATE= 1,
439
 
  OTM_ALTER= 2
440
 
};
441
 
 
442
 
 
443
 
/**
444
 
 * used by several functions in functions/time directory
445
 
 *
446
 
**/
447
 
enum date_time_format_types
448
 
{
449
 
  TIME_ONLY= 0, TIME_MICROSECOND, DATE_ONLY, DATE_TIME, DATE_TIME_MICROSECOND
450
 
};
451
 
 
452
 
 
453
 
enum enum_parsing_place
454
 
{
455
 
  NO_MATTER
456
 
  , IN_HAVING
457
 
  , SELECT_LIST
458
 
  , IN_WHERE
459
 
  , IN_ON
460
 
};
461
 
 
462
 
enum enum_mysql_completiontype {
463
 
  ROLLBACK_RELEASE= -2
464
 
  , ROLLBACK= 1
465
 
  , ROLLBACK_AND_CHAIN= 7
466
 
  , COMMIT_RELEASE= -1
467
 
  , COMMIT= 0
468
 
  , COMMIT_AND_CHAIN= 6
469
 
};
470
 
 
471
 
enum enum_check_fields
472
 
{
473
 
  CHECK_FIELD_IGNORE
474
 
  , CHECK_FIELD_WARN
475
 
  , CHECK_FIELD_ERROR_FOR_NULL
476
 
};
477
 
 
478
 
enum enum_var_type
479
 
{
480
 
  OPT_DEFAULT= 0
481
 
  , OPT_SESSION
482
 
  , OPT_GLOBAL
483
 
};
484
 
 
485
 
 
486
 
typedef uint64_t query_id_t;
487
 
typedef void *range_seq_t;
488
 
 
489
 
 
490
 
/**
491
 
   The maximum is defined as (ULONG_MAX/1000) with 4 bytes uint32_t
492
 
*/
493
 
static const uint32_t SLAVE_MAX_HEARTBEAT_PERIOD= 4294967;
494
 
 
495
 
#define SLAVE_NET_TIMEOUT  3600
496
 
 
497
 
#define MAX_SLAVE_ERROR    2000
498
 
 
499
 
/* masks for start/stop operations on io and sql slave threads */
500
 
#define SLAVE_IO  1
501
 
#define SLAVE_SQL 2
502
 
 
503
 
#ifndef NO_HASH
504
 
#define NO_HASH                         /* Not yet implemented */
505
 
#endif
506
 
 
507
 
// the following is for checking tables
508
 
 
509
 
#define HA_ADMIN_ALREADY_DONE     1
510
 
#define HA_ADMIN_OK               0
511
 
#define HA_ADMIN_NOT_IMPLEMENTED -1
512
 
#define HA_ADMIN_FAILED          -2
513
 
#define HA_ADMIN_CORRUPT         -3
514
 
#define HA_ADMIN_INTERNAL_ERROR  -4
515
 
#define HA_ADMIN_INVALID         -5
516
 
#define HA_ADMIN_REJECT          -6
517
 
#define HA_ADMIN_TRY_ALTER       -7
518
 
#define HA_ADMIN_WRONG_CHECKSUM  -8
519
 
#define HA_ADMIN_NOT_BASE_TABLE  -9
520
 
#define HA_ADMIN_NEEDS_UPGRADE  -10
521
 
#define HA_ADMIN_NEEDS_ALTER    -11
522
 
#define HA_ADMIN_NEEDS_CHECK    -12
523
 
 
524
 
 
525
 
#define HA_ADD_INDEX                  (0)
526
 
#define HA_DROP_INDEX                 (1)
527
 
#define HA_ALTER_INDEX                (2)
528
 
#define HA_RENAME_INDEX               (3)
529
 
#define HA_ADD_UNIQUE_INDEX           (4)
530
 
#define HA_DROP_UNIQUE_INDEX          (5)
531
 
#define HA_ALTER_UNIQUE_INDEX         (6)
532
 
#define HA_RENAME_UNIQUE_INDEX        (7)
533
 
#define HA_ADD_PK_INDEX               (8)
534
 
#define HA_DROP_PK_INDEX              (9)
535
 
#define HA_ALTER_PK_INDEX             (10)
536
 
#define HA_ADD_COLUMN                 (11)
537
 
#define HA_DROP_COLUMN                (12)
538
 
#define HA_CHANGE_COLUMN              (13)
539
 
#define HA_ALTER_COLUMN_NAME          (14)
540
 
#define HA_ALTER_COLUMN_TYPE          (15)
541
 
#define HA_ALTER_COLUMN_ORDER         (16)
542
 
#define HA_ALTER_COLUMN_NULLABLE      (17)
543
 
#define HA_COLUMN_DEFAULT_VALUE       (18)
544
 
#define HA_COLUMN_STORAGE             (19)
545
 
#define HA_COLUMN_FORMAT              (20)
546
 
#define HA_ADD_FOREIGN_KEY            (21)
547
 
#define HA_DROP_FOREIGN_KEY           (22)
548
 
#define HA_ALTER_FOREIGN_KEY          (23)
549
 
#define HA_ADD_CONSTRAINT             (24)
550
 
#define HA_CHANGE_CHARACTER_SET       (30)
551
 
#define HA_SET_DEFAULT_CHARACTER_SET  (31)
552
 
#define HA_CHANGE_AUTOINCREMENT_VALUE (32)
553
 
#define HA_ALTER_STORAGE              (33)
554
 
#define HA_ALTER_TABLESPACE           (34)
555
 
#define HA_ALTER_ROW_FORMAT           (35)
556
 
#define HA_RENAME_TABLE               (36)
557
 
#define HA_ALTER_STORAGE_ENGINE       (37)
558
 
#define HA_RECREATE                   (38)
559
 
#define HA_ALTER_STORED_VCOL          (39)
560
 
/* Remember to increase HA_MAX_ALTER_FLAGS when adding more flags! */
561
 
 
562
 
/* Return values for check_if_supported_alter */
563
 
 
564
 
#define HA_ALTER_ERROR               -1
565
 
#define HA_ALTER_SUPPORTED_WAIT_LOCK  0
566
 
#define HA_ALTER_SUPPORTED_NO_LOCK    1
567
 
#define HA_ALTER_NOT_SUPPORTED        2
568
 
 
569
 
/* Bits in table_flags() to show what database can do */
570
 
 
571
 
#define HA_NO_TRANSACTIONS     (1 << 0) /* Doesn't support transactions */
572
 
#define HA_PARTIAL_COLUMN_READ (1 << 1) /* read may not return all columns */
573
 
#define HA_TABLE_SCAN_ON_INDEX (1 << 2) /* No separate data/index file */
574
 
/*
575
 
  The following should be set if the following is not true when scanning
576
 
  a table with rnd_next()
577
 
  - We will see all rows (including deleted ones)
578
 
  - Row positions are 'table->s->db_record_offset' apart
579
 
  If this flag is not set, filesort will do a postion() call for each matched
580
 
  row to be able to find the row later.
581
 
*/
582
 
#define HA_REC_NOT_IN_SEQ      (1 << 3)
583
 
 
584
 
/*
585
 
  Reading keys in random order is as fast as reading keys in sort order
586
 
  (Used in records.cc to decide if we should use a record cache and by
587
 
  filesort to decide if we should sort key + data or key + pointer-to-row
588
 
*/
589
 
#define HA_FAST_KEY_READ       (1 << 5)
590
 
/*
591
 
  Set the following flag if we on delete should force all key to be read
592
 
  and on update read all keys that changes
593
 
*/
594
 
#define HA_REQUIRES_KEY_COLUMNS_FOR_DELETE (1 << 6)
595
 
#define HA_NULL_IN_KEY         (1 << 7) /* One can have keys with NULL */
596
 
#define HA_DUPLICATE_POS       (1 << 8)    /* ha_position() gives dup row */
597
 
#define HA_NO_BLOBS            (1 << 9) /* Doesn't support blobs */
598
 
#define HA_CAN_INDEX_BLOBS     (1 << 10)
599
 
#define HA_AUTO_PART_KEY       (1 << 11) /* auto-increment in multi-part key */
600
 
#define HA_REQUIRE_PRIMARY_KEY (1 << 12) /* .. and can't create a hidden one */
601
 
#define HA_STATS_RECORDS_IS_EXACT (1 << 13) /* stats.records is exact */
602
 
/*
603
 
  If we get the primary key columns for free when we do an index read
604
 
  It also implies that we have to retrive the primary key when using
605
 
  position() and rnd_pos().
606
 
*/
607
 
#define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)
608
 
/*
609
 
  If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position()
610
 
  uses a primary key. Without primary key, we can't call position().
611
 
*/
612
 
#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1 << 16)
613
 
#define HA_NOT_DELETE_WITH_CACHE (1 << 18)
614
 
/*
615
 
  The following is we need to a primary key to delete (and update) a row.
616
 
  If there is no primary key, all columns needs to be read on update and delete
617
 
*/
618
 
#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE (1 << 19)
619
 
#define HA_NO_PREFIX_CHAR_KEYS (1 << 20)
620
 
#define HA_NO_AUTO_INCREMENT   (1 << 23)
621
 
#define HA_HAS_CHECKSUM        (1 << 24)
622
 
/* Table data are stored in separate files (for lower_case_table_names) */
623
 
#define HA_FILE_BASED          (1 << 26)
624
 
#define HA_NEED_READ_RANGE_BUFFER (1 << 29) /* for read_multi_range */
625
 
#define HA_ANY_INDEX_MAY_BE_UNIQUE (1 << 30)
626
 
#define HA_NO_COPY_ON_ALTER    (INT64_C(1) << 31)
627
 
#define HA_HAS_RECORDS         (INT64_C(1) << 32) /* records() gives exact count*/
628
 
#define HA_MRR_CANT_SORT       (INT64_C(1) << 34)
629
 
 
630
 
/*
631
 
  Engine is capable of row-format and statement-format logging,
632
 
  respectively
633
 
*/
634
 
#define HA_BINLOG_ROW_CAPABLE  (INT64_C(1) << 35)
635
 
#define HA_BINLOG_STMT_CAPABLE (INT64_C(1) << 36)
636
 
 
637
 
#define HA_ONLINE_ALTER        (INT64_C(1) << 37)
638
 
 
639
 
/*
640
 
  Set of all binlog flags. Currently only contain the capabilities
641
 
  flags.
642
 
 */
643
 
#define HA_BINLOG_FLAGS (HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE)
644
 
 
645
 
/* bits in index_flags(index_number) for what you can do with index */
646
 
#define HA_READ_NEXT            1       /* TODO really use this flag */
647
 
#define HA_READ_PREV            2       /* supports ::index_prev */
648
 
#define HA_READ_ORDER           4       /* index_next/prev follow sort order */
649
 
#define HA_READ_RANGE           8       /* can find all records in a range */
650
 
#define HA_ONLY_WHOLE_INDEX     16      /* Can't use part key searches */
651
 
#define HA_KEYREAD_ONLY         64      /* Support HA_EXTRA_KEYREAD */
652
 
/*
653
 
  Index scan will not return records in rowid order. Not guaranteed to be
654
 
  set for unordered (e.g. HASH) indexes.
655
 
*/
656
 
#define HA_KEY_SCAN_NOT_ROR     128
657
 
#define HA_DO_INDEX_COND_PUSHDOWN  256 /* Supports Index Condition Pushdown */
658
 
 
659
 
 
660
 
 
661
 
/*
662
 
  HA_PARTITION_FUNCTION_SUPPORTED indicates that the function is
663
 
  supported at all.
664
 
  HA_FAST_CHANGE_PARTITION means that optimised variants of the changes
665
 
  exists but they are not necessarily done online.
666
 
 
667
 
  HA_ONLINE_DOUBLE_WRITE means that the handler supports writing to both
668
 
  the new partition and to the old partitions when updating through the
669
 
  old partitioning schema while performing a change of the partitioning.
670
 
  This means that we can support updating of the table while performing
671
 
  the copy phase of the change. For no lock at all also a double write
672
 
  from new to old must exist and this is not required when this flag is
673
 
  set.
674
 
  This is actually removed even before it was introduced the first time.
675
 
  The new idea is that handlers will handle the lock level already in
676
 
  store_lock for ALTER Table partitions.
677
 
 
678
 
  HA_PARTITION_ONE_PHASE is a flag that can be set by handlers that take
679
 
  care of changing the partitions online and in one phase. Thus all phases
680
 
  needed to handle the change are implemented inside the storage engine.
681
 
  The storage engine must also support auto-discovery since the frm file
682
 
  is changed as part of the change and this change must be controlled by
683
 
  the storage engine. A typical engine to support this is NDB (through
684
 
  WL #2498).
685
 
*/
686
 
#define HA_PARTITION_FUNCTION_SUPPORTED         (1L << 1)
687
 
#define HA_FAST_CHANGE_PARTITION                (1L << 2)
688
 
#define HA_PARTITION_ONE_PHASE                  (1L << 3)
689
 
 
690
 
/* operations for disable/enable indexes */
691
 
#define HA_KEY_SWITCH_NONUNIQ      0
692
 
#define HA_KEY_SWITCH_ALL          1
693
 
#define HA_KEY_SWITCH_NONUNIQ_SAVE 2
694
 
#define HA_KEY_SWITCH_ALL_SAVE     3
695
 
 
696
 
/*
697
 
  Note: the following includes binlog and closing 0.
698
 
  so: innodb + bdb + ndb + binlog + myisam + myisammrg + archive +
699
 
      example + csv + heap + blackhole + federated + 0
700
 
  (yes, the sum is deliberately inaccurate)
701
 
  TODO remove the limit, use dynarrays
702
 
*/
703
 
#define MAX_HA 15
704
 
 
705
 
/*
706
 
  Parameters for open() (in register form->filestat)
707
 
  HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED
708
 
*/
709
 
 
710
 
#define HA_OPEN_KEYFILE         1
711
 
#define HA_OPEN_RNDFILE         2
712
 
#define HA_GET_INDEX            4
713
 
#define HA_GET_INFO             8       /* do a ha_info() after open */
714
 
#define HA_READ_ONLY            16      /* File opened as readonly */
715
 
/* Try readonly if can't open with read and write */
716
 
#define HA_TRY_READ_ONLY        32
717
 
#define HA_WAIT_IF_LOCKED       64      /* Wait if locked on open */
718
 
#define HA_ABORT_IF_LOCKED      128     /* skip if locked on open.*/
719
 
#define HA_BLOCK_LOCK           256     /* unlock when reading some records */
720
 
#define HA_OPEN_TEMPORARY       512
721
 
 
722
 
/* For transactional LOCK Table. handler::lock_table() */
723
 
#define HA_LOCK_IN_SHARE_MODE      F_RDLCK
724
 
#define HA_LOCK_IN_EXCLUSIVE_MODE  F_WRLCK
725
 
 
726
 
/* Some key definitions */
727
 
#define HA_KEY_NULL_LENGTH      1
728
 
#define HA_KEY_BLOB_LENGTH      2
729
 
 
730
 
#define HA_LEX_CREATE_TMP_TABLE 1
731
 
#define HA_LEX_CREATE_IF_NOT_EXISTS 2
732
 
#define HA_LEX_CREATE_TABLE_LIKE 4
733
 
#define HA_OPTION_NO_CHECKSUM   (1L << 17)
734
 
#define HA_OPTION_NO_DELAY_KEY_WRITE (1L << 18)
735
 
#define HA_MAX_REC_LENGTH       65535
736
 
 
737
 
/* Table caching type */
738
 
#define HA_CACHE_TBL_NONTRANSACT 0
739
 
#define HA_CACHE_TBL_NOCACHE     1
740
 
#define HA_CACHE_TBL_ASKTRANSACT 2
741
 
#define HA_CACHE_TBL_TRANSACT    4
742
 
 
743
 
/* Options of START TRANSACTION statement (and later of SET TRANSACTION stmt) */
744
 
#define DRIZZLE_START_TRANS_OPT_WITH_CONS_SNAPSHOT 1
745
 
 
746
 
/* Flags for method is_fatal_error */
747
 
#define HA_CHECK_DUP_KEY 1
748
 
#define HA_CHECK_DUP_UNIQUE 2
749
 
#define HA_CHECK_DUP (HA_CHECK_DUP_KEY + HA_CHECK_DUP_UNIQUE)
750
 
 
751
 
enum legacy_db_type
752
 
{
753
 
  DB_TYPE_UNKNOWN=0,
754
 
  DB_TYPE_FIRST_DYNAMIC=42,
755
 
  DB_TYPE_DEFAULT=127 // Must be last
756
 
};
757
 
 
758
 
enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
759
 
                ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED,
760
 
                ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT, ROW_TYPE_PAGE };
761
 
 
762
 
enum column_format_type { COLUMN_FORMAT_TYPE_NOT_USED= -1,
763
 
                          COLUMN_FORMAT_TYPE_DEFAULT=   0,
764
 
                          COLUMN_FORMAT_TYPE_FIXED=     1,
765
 
                          COLUMN_FORMAT_TYPE_DYNAMIC=   2 };
766
 
 
767
 
enum enum_binlog_func {
768
 
  BFN_RESET_LOGS=        1,
769
 
  BFN_RESET_SLAVE=       2,
770
 
  BFN_BINLOG_WAIT=       3,
771
 
  BFN_BINLOG_END=        4,
772
 
  BFN_BINLOG_PURGE_FILE= 5
773
 
};
774
 
 
775
 
enum enum_binlog_command {
776
 
  LOGCOM_CREATE_TABLE,
777
 
  LOGCOM_ALTER_TABLE,
778
 
  LOGCOM_RENAME_TABLE,
779
 
  LOGCOM_DROP_TABLE,
780
 
  LOGCOM_CREATE_DB,
781
 
  LOGCOM_ALTER_DB,
782
 
  LOGCOM_DROP_DB
783
 
};
784
 
 
785
 
/* struct to hold information about the table that should be created */
786
 
 
787
 
/* Bits in used_fields */
788
 
#define HA_CREATE_USED_AUTO             (1L << 0)
789
 
#ifdef DEAD_OPTIONS
790
 
#define HA_CREATE_USED_UNION            (1L << 2)
791
 
#define HA_CREATE_USED_PASSWORD         (1L << 17)
792
 
#endif
793
 
#define HA_CREATE_USED_INSERT_METHOD    (1L << 3)
794
 
#define HA_CREATE_USED_MIN_ROWS         (1L << 4)
795
 
#define HA_CREATE_USED_MAX_ROWS         (1L << 5)
796
 
#define HA_CREATE_USED_AVG_ROW_LENGTH   (1L << 6)
797
 
#define HA_CREATE_USED_PACK_KEYS        (1L << 7)
798
 
#define HA_CREATE_USED_CHARSET          (1L << 8)
799
 
#define HA_CREATE_USED_DEFAULT_CHARSET  (1L << 9)
800
 
#define HA_CREATE_USED_DATADIR          (1L << 10)
801
 
#define HA_CREATE_USED_INDEXDIR         (1L << 11)
802
 
#define HA_CREATE_USED_ENGINE           (1L << 12)
803
 
#define HA_CREATE_USED_CHECKSUM         (1L << 13)
804
 
#define HA_CREATE_USED_DELAY_KEY_WRITE  (1L << 14)
805
 
#define HA_CREATE_USED_ROW_FORMAT       (1L << 15)
806
 
#define HA_CREATE_USED_COMMENT          (1L << 16)
807
 
#define HA_CREATE_USED_CONNECTION       (1L << 18)
808
 
#define HA_CREATE_USED_KEY_BLOCK_SIZE   (1L << 19)
809
 
#define HA_CREATE_USED_PAGE_CHECKSUM    (1L << 21)
810
 
#define HA_CREATE_USED_BLOCK_SIZE       (1L << 22)
811
 
 
812
 
#define MAXGTRIDSIZE 64
813
 
#define MAXBQUALSIZE 64
814
 
 
815
 
#define COMPATIBLE_DATA_YES 0
816
 
#define COMPATIBLE_DATA_NO  1
817
 
 
818
 
#define UNDEF_NODEGROUP 65535
819
 
#define NOT_A_PARTITION_ID ((uint32_t)-1)
820
 
 
821
 
enum ha_choice { HA_CHOICE_UNDEF, HA_CHOICE_NO, HA_CHOICE_YES };
822
 
 
823
 
/*
824
 
  The below two are not used (and not handled) in this milestone of this WL
825
 
  entry because there seems to be no use for them at this stage of
826
 
  implementation.
827
 
*/
828
 
#define HA_MRR_SINGLE_POINT 1
829
 
#define HA_MRR_FIXED_KEY  2
830
 
 
831
 
/*
832
 
  Indicates that RANGE_SEQ_IF::next(&range) doesn't need to fill in the
833
 
  'range' parameter.
834
 
*/
835
 
#define HA_MRR_NO_ASSOCIATION 4
836
 
 
837
 
/*
838
 
  The MRR user will provide ranges in key order, and MRR implementation
839
 
  must return rows in key order.
840
 
*/
841
 
#define HA_MRR_SORTED 8
842
 
 
843
 
/* MRR implementation doesn't have to retrieve full records */
844
 
#define HA_MRR_INDEX_ONLY 16
845
 
 
846
 
/*
847
 
  The passed memory buffer is of maximum possible size, the caller can't
848
 
  assume larger buffer.
849
 
*/
850
 
#define HA_MRR_LIMITS 32
851
 
 
852
 
 
853
 
/*
854
 
  Flag set <=> default MRR implementation is used
855
 
  (The choice is made by **_info[_const]() function which may set this
856
 
   flag. SQL layer remembers the flag value and then passes it to
857
 
   multi_read_range_init().
858
 
*/
859
 
#define HA_MRR_USE_DEFAULT_IMPL 64
860
 
 
861
 
/*
862
 
  Used only as parameter to multi_range_read_info():
863
 
  Flag set <=> the caller guarantees that the bounds of the scanned ranges
864
 
  will not have NULL values.
865
 
*/
866
 
#define HA_MRR_NO_NULL_ENDPOINTS 128
867
 
 
868
 
enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME };
869
 
 
870
 
enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED,
871
 
                         ISO_REPEATABLE_READ, ISO_SERIALIZABLE};
872
 
 
873
 
 
874
 
enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED};
875
 
 
876
 
typedef int myf;
877
 
#define MYF(v)          (myf) (v)
878
 
 
879
 
/*
880
 
  When a command is added here, be sure it's also added in mysqld.cc
881
 
  in "struct show_var_st status_vars[]= {" ...
882
 
 
883
 
  If the command returns a result set or is not allowed in stored
884
 
  functions or triggers, please also make sure that
885
 
  sp_get_flags_for_command (sp_head.cc) returns proper flags for the
886
 
  added SQLCOM_.
887
 
*/
888
 
 
889
 
enum enum_sql_command {
890
 
  SQLCOM_SELECT, SQLCOM_CREATE_TABLE, SQLCOM_CREATE_INDEX, SQLCOM_ALTER_TABLE,
891
 
  SQLCOM_UPDATE, SQLCOM_INSERT, SQLCOM_INSERT_SELECT,
892
 
  SQLCOM_DELETE, SQLCOM_TRUNCATE, SQLCOM_DROP_TABLE, SQLCOM_DROP_INDEX,
893
 
  SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
894
 
  SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_STATUS,
895
 
  SQLCOM_SHOW_ENGINE_LOGS, SQLCOM_SHOW_ENGINE_STATUS, SQLCOM_SHOW_ENGINE_MUTEX,
896
 
  SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT,
897
 
  SQLCOM_SHOW_CREATE,
898
 
  SQLCOM_SHOW_CREATE_DB,
899
 
  SQLCOM_SHOW_TABLE_STATUS,
900
 
  SQLCOM_LOAD,SQLCOM_SET_OPTION,SQLCOM_LOCK_TABLES,SQLCOM_UNLOCK_TABLES,
901
 
  SQLCOM_CHANGE_DB, SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB,
902
 
  SQLCOM_REPAIR, SQLCOM_REPLACE, SQLCOM_REPLACE_SELECT,
903
 
  SQLCOM_OPTIMIZE, SQLCOM_CHECK,
904
 
  SQLCOM_ASSIGN_TO_KEYCACHE,
905
 
  SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_ANALYZE,
906
 
  SQLCOM_ROLLBACK, SQLCOM_ROLLBACK_TO_SAVEPOINT,
907
 
  SQLCOM_COMMIT, SQLCOM_SAVEPOINT, SQLCOM_RELEASE_SAVEPOINT,
908
 
  SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP,
909
 
  SQLCOM_BEGIN, SQLCOM_CHANGE_MASTER,
910
 
  SQLCOM_RENAME_TABLE,
911
 
  SQLCOM_RESET, SQLCOM_PURGE, SQLCOM_PURGE_BEFORE, SQLCOM_SHOW_BINLOGS,
912
 
  SQLCOM_SHOW_OPEN_TABLES,
913
 
  SQLCOM_DELETE_MULTI, SQLCOM_UPDATE_MULTI,
914
 
  SQLCOM_SHOW_WARNS,
915
 
  SQLCOM_EMPTY_QUERY,
916
 
  SQLCOM_SHOW_ERRORS,
917
 
  SQLCOM_CHECKSUM,
918
 
  SQLCOM_BINLOG_BASE64_EVENT,
919
 
  SQLCOM_SHOW_PLUGINS,
920
 
  /*
921
 
    When a command is added here, be sure it's also added in mysqld.cc
922
 
    in "struct show_var_st status_vars[]= {" ...
923
 
  */
924
 
  /* This should be the last !!! */
925
 
  SQLCOM_END
926
 
};
927
 
 
928
 
enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_UPDATE };
929
 
 
930
 
enum release_type { RELEASE_NORMAL, RELEASE_WAIT_FOR_DROP };
931
 
 
932
 
/*
933
 
  Make sure that the order of schema_tables and enum_schema_tables are the same.
934
 
*/
935
 
 
936
 
enum enum_schema_tables
937
 
{
938
 
  SCH_CHARSETS= 0,
939
 
  SCH_COLLATIONS,
940
 
  SCH_COLLATION_CHARACTER_SET_APPLICABILITY,
941
 
  SCH_COLUMNS,
942
 
  SCH_GLOBAL_STATUS,
943
 
  SCH_GLOBAL_VARIABLES,
944
 
  SCH_KEY_COLUMN_USAGE,
945
 
  SCH_OPEN_TABLES,
946
 
  SCH_PLUGINS,
947
 
  SCH_PROCESSLIST,
948
 
  SCH_REFERENTIAL_CONSTRAINTS,
949
 
  SCH_SCHEMATA,
950
 
  SCH_SESSION_STATUS,
951
 
  SCH_SESSION_VARIABLES,
952
 
  SCH_STATISTICS,
953
 
  SCH_STATUS,
954
 
  SCH_TABLES,
955
 
  SCH_TABLE_CONSTRAINTS,
956
 
  SCH_TABLE_NAMES,
957
 
  SCH_VARIABLES
958
 
};
959
 
 
960
 
 
961
 
#define MY_I_S_MAYBE_NULL 1
962
 
#define MY_I_S_UNSIGNED   2
963
 
 
964
 
 
965
 
#define SKIP_OPEN_TABLE 0                // do not open table
966
 
#define OPEN_FRM_ONLY   1                // open FRM file only
967
 
#define OPEN_FULL_TABLE 2                // open FRM,MYD, MYI files
968
 
 
969
 
/*
970
 
   "Declared Type Collation"
971
 
   A combination of collation and its derivation.
972
 
 
973
 
  Flags for collation aggregation modes:
974
 
  MY_COLL_ALLOW_SUPERSET_CONV  - allow conversion to a superset
975
 
  MY_COLL_ALLOW_COERCIBLE_CONV - allow conversion of a coercible value
976
 
                                 (i.e. constant).
977
 
  MY_COLL_ALLOW_CONV           - allow any kind of conversion
978
 
                                 (combination of the above two)
979
 
  MY_COLL_DISALLOW_NONE        - don't allow return DERIVATION_NONE
980
 
                                 (e.g. when aggregating for comparison)
981
 
  MY_COLL_CMP_CONV             - combination of MY_COLL_ALLOW_CONV
982
 
                                 and MY_COLL_DISALLOW_NONE
983
 
*/
984
 
 
985
 
#define MY_COLL_ALLOW_SUPERSET_CONV   1
986
 
#define MY_COLL_ALLOW_COERCIBLE_CONV  2
987
 
#define MY_COLL_ALLOW_CONV            3
988
 
#define MY_COLL_DISALLOW_NONE         4
989
 
#define MY_COLL_CMP_CONV              7
990
 
 
991
 
 
992
 
/*
993
 
  This enum is used to report information about monotonicity of function
994
 
  represented by Item* tree.
995
 
  Monotonicity is defined only for Item* trees that represent table
996
 
  partitioning expressions (i.e. have no subselects/user vars/PS parameters
997
 
  etc etc). An Item* tree is assumed to have the same monotonicity properties
998
 
  as its correspoinding function F:
999
 
 
1000
 
  [signed] int64_t F(field1, field2, ...) {
1001
 
    put values of field_i into table record buffer;
1002
 
    return item->val_int();
1003
 
  }
1004
 
 
1005
 
  NOTE
1006
 
  At the moment function monotonicity is not well defined (and so may be
1007
 
  incorrect) for Item trees with parameters/return types that are different
1008
 
  from INT_RESULT, may be NULL, or are unsigned.
1009
 
  It will be possible to address this issue once the related partitioning bugs
1010
 
  (BUG#16002, BUG#15447, BUG#13436) are fixed.
1011
 
*/
1012
 
 
1013
 
typedef enum monotonicity_info
1014
 
{
1015
 
   NON_MONOTONIC,              /* none of the below holds */
1016
 
   MONOTONIC_INCREASING,       /* F() is unary and (x < y) => (F(x) <= F(y)) */
1017
 
   MONOTONIC_STRICT_INCREASING /* F() is unary and (x < y) => (F(x) <  F(y)) */
1018
 
} enum_monotonicity_info;
1019
 
 
1020
 
enum tmp_table_type
1021
 
{
1022
 
  NO_TMP_TABLE, NON_TRANSACTIONAL_TMP_TABLE, TRANSACTIONAL_TMP_TABLE,
1023
 
  INTERNAL_TMP_TABLE, SYSTEM_TMP_TABLE, TMP_TABLE_FRM_FILE_ONLY
1024
 
};
1025
 
 
1026
 
/*
1027
 
  Values in this enum are used to indicate how a tables TIMESTAMP field
1028
 
  should be treated. It can be set to the current timestamp on insert or
1029
 
  update or both.
1030
 
  WARNING: The values are used for bit operations. If you change the
1031
 
  enum, you must keep the bitwise relation of the values. For example:
1032
 
  (int) TIMESTAMP_AUTO_SET_ON_BOTH must be equal to
1033
 
  (int) TIMESTAMP_AUTO_SET_ON_INSERT | (int) TIMESTAMP_AUTO_SET_ON_UPDATE.
1034
 
  We use an enum here so that the debugger can display the value names.
1035
 
*/
1036
 
enum timestamp_auto_set_type
1037
 
{
1038
 
  TIMESTAMP_NO_AUTO_SET= 0, TIMESTAMP_AUTO_SET_ON_INSERT= 1,
1039
 
  TIMESTAMP_AUTO_SET_ON_UPDATE= 2, TIMESTAMP_AUTO_SET_ON_BOTH= 3
1040
 
};
1041
 
#define clear_timestamp_auto_bits(_target_, _bits_) \
1042
 
  (_target_)= (enum timestamp_auto_set_type)((int)(_target_) & ~(int)(_bits_))
1043
 
 
1044
 
/**
1045
 
  Category of table found in the table share.
1046
 
*/
1047
 
enum enum_table_category
1048
 
{
1049
 
  /**
1050
 
    Unknown value.
1051
 
  */
1052
 
  TABLE_UNKNOWN_CATEGORY=0,
1053
 
 
1054
 
  /**
1055
 
    Temporary table.
1056
 
    The table is visible only in the session.
1057
 
    Therefore,
1058
 
    - FLUSH TABLES WITH READ LOCK
1059
 
    - SET GLOBAL READ_ONLY = ON
1060
 
    do not apply to this table.
1061
 
    Note that LOCK Table t FOR READ/WRITE
1062
 
    can be used on temporary tables.
1063
 
    Temporary tables are not part of the table cache.
1064
 
  */
1065
 
  TABLE_CATEGORY_TEMPORARY=1,
1066
 
 
1067
 
  /**
1068
 
    User table.
1069
 
    These tables do honor:
1070
 
    - LOCK Table t FOR READ/WRITE
1071
 
    - FLUSH TABLES WITH READ LOCK
1072
 
    - SET GLOBAL READ_ONLY = ON
1073
 
    User tables are cached in the table cache.
1074
 
  */
1075
 
  TABLE_CATEGORY_USER=2,
1076
 
 
1077
 
  /**
1078
 
    Information schema tables.
1079
 
    These tables are an interface provided by the system
1080
 
    to inspect the system metadata.
1081
 
    These tables do *not* honor:
1082
 
    - LOCK Table t FOR READ/WRITE
1083
 
    - FLUSH TABLES WITH READ LOCK
1084
 
    - SET GLOBAL READ_ONLY = ON
1085
 
    as there is no point in locking explicitely
1086
 
    an INFORMATION_SCHEMA table.
1087
 
    Nothing is directly written to information schema tables.
1088
 
    Note that this value is not used currently,
1089
 
    since information schema tables are not shared,
1090
 
    but implemented as session specific temporary tables.
1091
 
  */
1092
 
  /*
1093
 
    TODO: Fixing the performance issues of I_S will lead
1094
 
    to I_S tables in the table cache, which should use
1095
 
    this table type.
1096
 
  */
1097
 
  TABLE_CATEGORY_INFORMATION
1098
 
};
1099
 
 
1100
 
/* Information for one open table */
1101
 
enum index_hint_type
1102
 
{
1103
 
  INDEX_HINT_IGNORE,
1104
 
  INDEX_HINT_USE,
1105
 
  INDEX_HINT_FORCE
1106
 
};
1107
 
 
1108
 
 
1109
 
enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
1110
 
enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON,
1111
 
                            DELAY_KEY_WRITE_ALL };
1112
 
enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT,
1113
 
                            SLAVE_EXEC_MODE_IDEMPOTENT,
1114
 
                            SLAVE_EXEC_MODE_LAST_BIT};
1115
 
enum enum_mark_columns
1116
 
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
1117
 
 
1118
 
enum enum_filetype { FILETYPE_CSV, FILETYPE_XML };
1119
 
 
1120
 
enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND,
1121
 
                                  IGNORE_ERRORS, REPORT_EXCEPT_NON_UNIQUE,
1122
 
                                  IGNORE_EXCEPT_NON_UNIQUE};
1123
 
 
1124
 
enum enum_schema_table_state
1125
 
{
1126
 
  NOT_PROCESSED= 0,
1127
 
  PROCESSED_BY_CREATE_SORT_INDEX,
1128
 
  PROCESSED_BY_JOIN_EXEC
1129
 
};
1130
 
 
1131
 
/*
1132
 
 * The following are for the interface with the .frm file
1133
 
 */
1134
 
 
1135
 
#define FIELDFLAG_DECIMAL    1
1136
 
#define FIELDFLAG_BINARY    1  // Shares same flag
1137
 
#define FIELDFLAG_NUMBER    2
1138
 
#define FIELDFLAG_DECIMAL_POSITION      4
1139
 
#define FIELDFLAG_PACK      120  // Bits used for packing
1140
 
#define FIELDFLAG_INTERVAL    256     // mangled with decimals!
1141
 
#define FIELDFLAG_BLOB      1024  // mangled with decimals!
1142
 
 
1143
 
#define FIELDFLAG_NO_DEFAULT    16384   /* sql */
1144
 
#define FIELDFLAG_SUM      ((uint32_t) 32768)// predit: +#fieldflag
1145
 
#define FIELDFLAG_MAYBE_NULL    ((uint32_t) 32768)// sql
1146
 
#define FIELDFLAG_HEX_ESCAPE    ((uint32_t) 0x10000)
1147
 
#define FIELDFLAG_PACK_SHIFT    3
1148
 
#define FIELDFLAG_DEC_SHIFT    8
1149
 
#define FIELDFLAG_MAX_DEC    31
1150
 
 
1151
 
#define MTYP_TYPENR(type) (type & 127)  /* Remove bits from type */
1152
 
 
1153
 
#define f_is_dec(x)     ((x) & FIELDFLAG_DECIMAL)
1154
 
#define f_is_num(x)     ((x) & FIELDFLAG_NUMBER)
1155
 
#define f_is_decimal_precision(x)  ((x) & FIELDFLAG_DECIMAL_POSITION)
1156
 
#define f_is_packed(x)  ((x) & FIELDFLAG_PACK)
1157
 
#define f_packtype(x)   (((x) >> FIELDFLAG_PACK_SHIFT) & 15)
1158
 
#define f_decimals(x)   ((uint8_t) (((x) >> FIELDFLAG_DEC_SHIFT) & \
1159
 
                                     FIELDFLAG_MAX_DEC))
1160
 
#define f_is_alpha(x)   (!f_is_num(x))
1161
 
#define f_is_binary(x)  ((x) & FIELDFLAG_BINARY) // 4.0- compatibility
1162
 
#define f_is_enum(x)    (((x) & (FIELDFLAG_INTERVAL | FIELDFLAG_NUMBER)) == \
1163
 
                         FIELDFLAG_INTERVAL)
1164
 
#define f_is_blob(x)    (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == \
1165
 
                         FIELDFLAG_BLOB)
1166
 
#define f_is_equ(x)     ((x) & (1+2+FIELDFLAG_PACK+31*256))
1167
 
#define f_settype(x)    (((int) x) << FIELDFLAG_PACK_SHIFT)
1168
 
#define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL)
1169
 
#define f_no_default(x) (x & FIELDFLAG_NO_DEFAULT)
1170
 
#define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE)
1171
 
 
1172
384
#endif /* DRIZZLE_SERVER_DEFINITIONS_H */
1173