~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/definitions.h

  • Committer: Monty Taylor
  • Date: 2008-10-30 19:42:06 UTC
  • mto: (520.4.38 devel)
  • mto: This revision was merged to the branch mainline in revision 572.
  • Revision ID: monty@inaugust.com-20081030194206-fzus6yqlw1ekru65
Removed handler from common_includes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
492
492
#define SLAVE_IO  1
493
493
#define SLAVE_SQL 2
494
494
 
 
495
#ifndef NO_HASH
 
496
#define NO_HASH                         /* Not yet implemented */
 
497
#endif
 
498
 
 
499
// the following is for checking tables
 
500
 
 
501
#define HA_ADMIN_ALREADY_DONE     1
 
502
#define HA_ADMIN_OK               0
 
503
#define HA_ADMIN_NOT_IMPLEMENTED -1
 
504
#define HA_ADMIN_FAILED          -2
 
505
#define HA_ADMIN_CORRUPT         -3
 
506
#define HA_ADMIN_INTERNAL_ERROR  -4
 
507
#define HA_ADMIN_INVALID         -5
 
508
#define HA_ADMIN_REJECT          -6
 
509
#define HA_ADMIN_TRY_ALTER       -7
 
510
#define HA_ADMIN_WRONG_CHECKSUM  -8
 
511
#define HA_ADMIN_NOT_BASE_TABLE  -9
 
512
#define HA_ADMIN_NEEDS_UPGRADE  -10
 
513
#define HA_ADMIN_NEEDS_ALTER    -11
 
514
#define HA_ADMIN_NEEDS_CHECK    -12
 
515
 
 
516
 
 
517
#define HA_ADD_INDEX                  (0)
 
518
#define HA_DROP_INDEX                 (1)
 
519
#define HA_ALTER_INDEX                (2)
 
520
#define HA_RENAME_INDEX               (3)
 
521
#define HA_ADD_UNIQUE_INDEX           (4)
 
522
#define HA_DROP_UNIQUE_INDEX          (5)
 
523
#define HA_ALTER_UNIQUE_INDEX         (6)
 
524
#define HA_RENAME_UNIQUE_INDEX        (7)
 
525
#define HA_ADD_PK_INDEX               (8)
 
526
#define HA_DROP_PK_INDEX              (9)
 
527
#define HA_ALTER_PK_INDEX             (10)
 
528
#define HA_ADD_COLUMN                 (11)
 
529
#define HA_DROP_COLUMN                (12)
 
530
#define HA_CHANGE_COLUMN              (13)
 
531
#define HA_ALTER_COLUMN_NAME          (14)
 
532
#define HA_ALTER_COLUMN_TYPE          (15)
 
533
#define HA_ALTER_COLUMN_ORDER         (16)
 
534
#define HA_ALTER_COLUMN_NULLABLE      (17)
 
535
#define HA_COLUMN_DEFAULT_VALUE       (18)
 
536
#define HA_COLUMN_STORAGE             (19)
 
537
#define HA_COLUMN_FORMAT              (20)
 
538
#define HA_ADD_FOREIGN_KEY            (21)
 
539
#define HA_DROP_FOREIGN_KEY           (22)
 
540
#define HA_ALTER_FOREIGN_KEY          (23)
 
541
#define HA_ADD_CONSTRAINT             (24)
 
542
#define HA_CHANGE_CHARACTER_SET       (30)
 
543
#define HA_SET_DEFAULT_CHARACTER_SET  (31)
 
544
#define HA_CHANGE_AUTOINCREMENT_VALUE (32)
 
545
#define HA_ALTER_STORAGE              (33)
 
546
#define HA_ALTER_TABLESPACE           (34)
 
547
#define HA_ALTER_ROW_FORMAT           (35)
 
548
#define HA_RENAME_TABLE               (36)
 
549
#define HA_ALTER_STORAGE_ENGINE       (37)
 
550
#define HA_RECREATE                   (38)
 
551
#define HA_ALTER_STORED_VCOL          (39)
 
552
/* Remember to increase HA_MAX_ALTER_FLAGS when adding more flags! */
 
553
 
 
554
/* Return values for check_if_supported_alter */
 
555
 
 
556
#define HA_ALTER_ERROR               -1
 
557
#define HA_ALTER_SUPPORTED_WAIT_LOCK  0
 
558
#define HA_ALTER_SUPPORTED_NO_LOCK    1
 
559
#define HA_ALTER_NOT_SUPPORTED        2
 
560
 
 
561
/* Bits in table_flags() to show what database can do */
 
562
 
 
563
#define HA_NO_TRANSACTIONS     (1 << 0) /* Doesn't support transactions */
 
564
#define HA_PARTIAL_COLUMN_READ (1 << 1) /* read may not return all columns */
 
565
#define HA_TABLE_SCAN_ON_INDEX (1 << 2) /* No separate data/index file */
 
566
/*
 
567
  The following should be set if the following is not true when scanning
 
568
  a table with rnd_next()
 
569
  - We will see all rows (including deleted ones)
 
570
  - Row positions are 'table->s->db_record_offset' apart
 
571
  If this flag is not set, filesort will do a postion() call for each matched
 
572
  row to be able to find the row later.
 
573
*/
 
574
#define HA_REC_NOT_IN_SEQ      (1 << 3)
 
575
 
 
576
/*
 
577
  Reading keys in random order is as fast as reading keys in sort order
 
578
  (Used in records.cc to decide if we should use a record cache and by
 
579
  filesort to decide if we should sort key + data or key + pointer-to-row
 
580
*/
 
581
#define HA_FAST_KEY_READ       (1 << 5)
 
582
/*
 
583
  Set the following flag if we on delete should force all key to be read
 
584
  and on update read all keys that changes
 
585
*/
 
586
#define HA_REQUIRES_KEY_COLUMNS_FOR_DELETE (1 << 6)
 
587
#define HA_NULL_IN_KEY         (1 << 7) /* One can have keys with NULL */
 
588
#define HA_DUPLICATE_POS       (1 << 8)    /* ha_position() gives dup row */
 
589
#define HA_NO_BLOBS            (1 << 9) /* Doesn't support blobs */
 
590
#define HA_CAN_INDEX_BLOBS     (1 << 10)
 
591
#define HA_AUTO_PART_KEY       (1 << 11) /* auto-increment in multi-part key */
 
592
#define HA_REQUIRE_PRIMARY_KEY (1 << 12) /* .. and can't create a hidden one */
 
593
#define HA_STATS_RECORDS_IS_EXACT (1 << 13) /* stats.records is exact */
 
594
/*
 
595
  If we get the primary key columns for free when we do an index read
 
596
  It also implies that we have to retrive the primary key when using
 
597
  position() and rnd_pos().
 
598
*/
 
599
#define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)
 
600
/*
 
601
  If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position()
 
602
  uses a primary key. Without primary key, we can't call position().
 
603
*/ 
 
604
#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1 << 16) 
 
605
#define HA_NOT_DELETE_WITH_CACHE (1 << 18)
 
606
/*
 
607
  The following is we need to a primary key to delete (and update) a row.
 
608
  If there is no primary key, all columns needs to be read on update and delete
 
609
*/
 
610
#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE (1 << 19)
 
611
#define HA_NO_PREFIX_CHAR_KEYS (1 << 20)
 
612
#define HA_NO_AUTO_INCREMENT   (1 << 23)
 
613
#define HA_HAS_CHECKSUM        (1 << 24)
 
614
/* Table data are stored in separate files (for lower_case_table_names) */
 
615
#define HA_FILE_BASED          (1 << 26)
 
616
#define HA_NEED_READ_RANGE_BUFFER (1 << 29) /* for read_multi_range */
 
617
#define HA_ANY_INDEX_MAY_BE_UNIQUE (1 << 30)
 
618
#define HA_NO_COPY_ON_ALTER    (INT64_C(1) << 31)
 
619
#define HA_HAS_RECORDS         (INT64_C(1) << 32) /* records() gives exact count*/
 
620
#define HA_MRR_CANT_SORT       (INT64_C(1) << 34)
 
621
 
 
622
/*
 
623
  Engine is capable of row-format and statement-format logging,
 
624
  respectively
 
625
*/
 
626
#define HA_BINLOG_ROW_CAPABLE  (INT64_C(1) << 35)
 
627
#define HA_BINLOG_STMT_CAPABLE (INT64_C(1) << 36)
 
628
 
 
629
#define HA_ONLINE_ALTER        (INT64_C(1) << 37)
 
630
 
 
631
/*
 
632
  Set of all binlog flags. Currently only contain the capabilities
 
633
  flags.
 
634
 */
 
635
#define HA_BINLOG_FLAGS (HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE)
 
636
 
 
637
/* bits in index_flags(index_number) for what you can do with index */
 
638
#define HA_READ_NEXT            1       /* TODO really use this flag */
 
639
#define HA_READ_PREV            2       /* supports ::index_prev */
 
640
#define HA_READ_ORDER           4       /* index_next/prev follow sort order */
 
641
#define HA_READ_RANGE           8       /* can find all records in a range */
 
642
#define HA_ONLY_WHOLE_INDEX     16      /* Can't use part key searches */
 
643
#define HA_KEYREAD_ONLY         64      /* Support HA_EXTRA_KEYREAD */
 
644
/*
 
645
  Index scan will not return records in rowid order. Not guaranteed to be
 
646
  set for unordered (e.g. HASH) indexes.
 
647
*/
 
648
#define HA_KEY_SCAN_NOT_ROR     128 
 
649
#define HA_DO_INDEX_COND_PUSHDOWN  256 /* Supports Index Condition Pushdown */
 
650
 
 
651
 
 
652
 
 
653
/*
 
654
  HA_PARTITION_FUNCTION_SUPPORTED indicates that the function is
 
655
  supported at all.
 
656
  HA_FAST_CHANGE_PARTITION means that optimised variants of the changes
 
657
  exists but they are not necessarily done online.
 
658
 
 
659
  HA_ONLINE_DOUBLE_WRITE means that the handler supports writing to both
 
660
  the new partition and to the old partitions when updating through the
 
661
  old partitioning schema while performing a change of the partitioning.
 
662
  This means that we can support updating of the table while performing
 
663
  the copy phase of the change. For no lock at all also a double write
 
664
  from new to old must exist and this is not required when this flag is
 
665
  set.
 
666
  This is actually removed even before it was introduced the first time.
 
667
  The new idea is that handlers will handle the lock level already in
 
668
  store_lock for ALTER Table partitions.
 
669
 
 
670
  HA_PARTITION_ONE_PHASE is a flag that can be set by handlers that take
 
671
  care of changing the partitions online and in one phase. Thus all phases
 
672
  needed to handle the change are implemented inside the storage engine.
 
673
  The storage engine must also support auto-discovery since the frm file
 
674
  is changed as part of the change and this change must be controlled by
 
675
  the storage engine. A typical engine to support this is NDB (through
 
676
  WL #2498).
 
677
*/
 
678
#define HA_PARTITION_FUNCTION_SUPPORTED         (1L << 1)
 
679
#define HA_FAST_CHANGE_PARTITION                (1L << 2)
 
680
#define HA_PARTITION_ONE_PHASE                  (1L << 3)
 
681
 
 
682
/* operations for disable/enable indexes */
 
683
#define HA_KEY_SWITCH_NONUNIQ      0
 
684
#define HA_KEY_SWITCH_ALL          1
 
685
#define HA_KEY_SWITCH_NONUNIQ_SAVE 2
 
686
#define HA_KEY_SWITCH_ALL_SAVE     3
 
687
 
 
688
/*
 
689
  Note: the following includes binlog and closing 0.
 
690
  so: innodb + bdb + ndb + binlog + myisam + myisammrg + archive +
 
691
      example + csv + heap + blackhole + federated + 0
 
692
  (yes, the sum is deliberately inaccurate)
 
693
  TODO remove the limit, use dynarrays
 
694
*/
 
695
#define MAX_HA 15
 
696
 
 
697
/*
 
698
  Parameters for open() (in register form->filestat)
 
699
  HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED
 
700
*/
 
701
 
 
702
#define HA_OPEN_KEYFILE         1
 
703
#define HA_OPEN_RNDFILE         2
 
704
#define HA_GET_INDEX            4
 
705
#define HA_GET_INFO             8       /* do a ha_info() after open */
 
706
#define HA_READ_ONLY            16      /* File opened as readonly */
 
707
/* Try readonly if can't open with read and write */
 
708
#define HA_TRY_READ_ONLY        32
 
709
#define HA_WAIT_IF_LOCKED       64      /* Wait if locked on open */
 
710
#define HA_ABORT_IF_LOCKED      128     /* skip if locked on open.*/
 
711
#define HA_BLOCK_LOCK           256     /* unlock when reading some records */
 
712
#define HA_OPEN_TEMPORARY       512
 
713
 
 
714
/* For transactional LOCK Table. handler::lock_table() */
 
715
#define HA_LOCK_IN_SHARE_MODE      F_RDLCK
 
716
#define HA_LOCK_IN_EXCLUSIVE_MODE  F_WRLCK
 
717
 
 
718
/* Some key definitions */
 
719
#define HA_KEY_NULL_LENGTH      1
 
720
#define HA_KEY_BLOB_LENGTH      2
 
721
 
 
722
#define HA_LEX_CREATE_TMP_TABLE 1
 
723
#define HA_LEX_CREATE_IF_NOT_EXISTS 2
 
724
#define HA_LEX_CREATE_TABLE_LIKE 4
 
725
#define HA_OPTION_NO_CHECKSUM   (1L << 17)
 
726
#define HA_OPTION_NO_DELAY_KEY_WRITE (1L << 18)
 
727
#define HA_MAX_REC_LENGTH       65535
 
728
 
 
729
/* Table caching type */
 
730
#define HA_CACHE_TBL_NONTRANSACT 0
 
731
#define HA_CACHE_TBL_NOCACHE     1
 
732
#define HA_CACHE_TBL_ASKTRANSACT 2
 
733
#define HA_CACHE_TBL_TRANSACT    4
 
734
 
 
735
/* Options of START TRANSACTION statement (and later of SET TRANSACTION stmt) */
 
736
#define DRIZZLE_START_TRANS_OPT_WITH_CONS_SNAPSHOT 1
 
737
 
 
738
/* Flags for method is_fatal_error */
 
739
#define HA_CHECK_DUP_KEY 1
 
740
#define HA_CHECK_DUP_UNIQUE 2
 
741
#define HA_CHECK_DUP (HA_CHECK_DUP_KEY + HA_CHECK_DUP_UNIQUE)
 
742
 
 
743
enum legacy_db_type
 
744
{
 
745
  DB_TYPE_UNKNOWN=0,
 
746
  DB_TYPE_FIRST_DYNAMIC=42,
 
747
  DB_TYPE_DEFAULT=127 // Must be last
 
748
};
 
749
 
 
750
enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
 
751
                ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED,
 
752
                ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT, ROW_TYPE_PAGE };
 
753
 
 
754
enum column_format_type { COLUMN_FORMAT_TYPE_NOT_USED= -1,
 
755
                          COLUMN_FORMAT_TYPE_DEFAULT=   0,
 
756
                          COLUMN_FORMAT_TYPE_FIXED=     1,
 
757
                          COLUMN_FORMAT_TYPE_DYNAMIC=   2 };
 
758
 
 
759
enum enum_binlog_func {
 
760
  BFN_RESET_LOGS=        1,
 
761
  BFN_RESET_SLAVE=       2,
 
762
  BFN_BINLOG_WAIT=       3,
 
763
  BFN_BINLOG_END=        4,
 
764
  BFN_BINLOG_PURGE_FILE= 5
 
765
};
 
766
 
 
767
enum enum_binlog_command {
 
768
  LOGCOM_CREATE_TABLE,
 
769
  LOGCOM_ALTER_TABLE,
 
770
  LOGCOM_RENAME_TABLE,
 
771
  LOGCOM_DROP_TABLE,
 
772
  LOGCOM_CREATE_DB,
 
773
  LOGCOM_ALTER_DB,
 
774
  LOGCOM_DROP_DB
 
775
};
 
776
 
 
777
/* struct to hold information about the table that should be created */
 
778
 
 
779
/* Bits in used_fields */
 
780
#define HA_CREATE_USED_AUTO             (1L << 0)
 
781
#ifdef DEAD_OPTIONS
 
782
#define HA_CREATE_USED_UNION            (1L << 2)
 
783
#define HA_CREATE_USED_PASSWORD         (1L << 17)
 
784
#endif
 
785
#define HA_CREATE_USED_INSERT_METHOD    (1L << 3)
 
786
#define HA_CREATE_USED_MIN_ROWS         (1L << 4)
 
787
#define HA_CREATE_USED_MAX_ROWS         (1L << 5)
 
788
#define HA_CREATE_USED_AVG_ROW_LENGTH   (1L << 6)
 
789
#define HA_CREATE_USED_PACK_KEYS        (1L << 7)
 
790
#define HA_CREATE_USED_CHARSET          (1L << 8)
 
791
#define HA_CREATE_USED_DEFAULT_CHARSET  (1L << 9)
 
792
#define HA_CREATE_USED_DATADIR          (1L << 10)
 
793
#define HA_CREATE_USED_INDEXDIR         (1L << 11)
 
794
#define HA_CREATE_USED_ENGINE           (1L << 12)
 
795
#define HA_CREATE_USED_CHECKSUM         (1L << 13)
 
796
#define HA_CREATE_USED_DELAY_KEY_WRITE  (1L << 14)
 
797
#define HA_CREATE_USED_ROW_FORMAT       (1L << 15)
 
798
#define HA_CREATE_USED_COMMENT          (1L << 16)
 
799
#define HA_CREATE_USED_CONNECTION       (1L << 18)
 
800
#define HA_CREATE_USED_KEY_BLOCK_SIZE   (1L << 19)
 
801
#define HA_CREATE_USED_PAGE_CHECKSUM    (1L << 21)
 
802
#define HA_CREATE_USED_BLOCK_SIZE       (1L << 22)
 
803
 
 
804
#define MAXGTRIDSIZE 64
 
805
#define MAXBQUALSIZE 64
 
806
 
 
807
#define COMPATIBLE_DATA_YES 0
 
808
#define COMPATIBLE_DATA_NO  1
 
809
 
 
810
#define UNDEF_NODEGROUP 65535
 
811
#define NOT_A_PARTITION_ID ((uint32_t)-1)
 
812
 
 
813
enum ha_choice { HA_CHOICE_UNDEF, HA_CHOICE_NO, HA_CHOICE_YES };
 
814
 
 
815
/* Possible flags of a handlerton (there can be 32 of them) */
 
816
#define HTON_NO_FLAGS                 0
 
817
#define HTON_CLOSE_CURSORS_AT_COMMIT (1 << 0)
 
818
#define HTON_ALTER_NOT_SUPPORTED     (1 << 1) //Engine does not support alter
 
819
#define HTON_CAN_RECREATE            (1 << 2) //Delete all is used fro truncate
 
820
#define HTON_HIDDEN                  (1 << 3) //Engine does not appear in lists
 
821
#define HTON_FLUSH_AFTER_RENAME      (1 << 4)
 
822
#define HTON_NOT_USER_SELECTABLE     (1 << 5)
 
823
#define HTON_TEMPORARY_NOT_SUPPORTED (1 << 6) //Having temporary tables not supported
 
824
#define HTON_SUPPORT_LOG_TABLES      (1 << 7) //Engine supports log tables
 
825
#define HTON_NO_PARTITION            (1 << 8) //You can not partition these tables
 
826
/*
 
827
  The below two are not used (and not handled) in this milestone of this WL
 
828
  entry because there seems to be no use for them at this stage of
 
829
  implementation.
 
830
*/
 
831
#define HA_MRR_SINGLE_POINT 1
 
832
#define HA_MRR_FIXED_KEY  2
 
833
 
 
834
/* 
 
835
  Indicates that RANGE_SEQ_IF::next(&range) doesn't need to fill in the
 
836
  'range' parameter.
 
837
*/
 
838
#define HA_MRR_NO_ASSOCIATION 4
 
839
 
 
840
/* 
 
841
  The MRR user will provide ranges in key order, and MRR implementation
 
842
  must return rows in key order.
 
843
*/
 
844
#define HA_MRR_SORTED 8
 
845
 
 
846
/* MRR implementation doesn't have to retrieve full records */
 
847
#define HA_MRR_INDEX_ONLY 16
 
848
 
 
849
/* 
 
850
  The passed memory buffer is of maximum possible size, the caller can't
 
851
  assume larger buffer.
 
852
*/
 
853
#define HA_MRR_LIMITS 32
 
854
 
 
855
 
 
856
/*
 
857
  Flag set <=> default MRR implementation is used
 
858
  (The choice is made by **_info[_const]() function which may set this
 
859
   flag. SQL layer remembers the flag value and then passes it to
 
860
   multi_read_range_init().
 
861
*/
 
862
#define HA_MRR_USE_DEFAULT_IMPL 64
 
863
 
 
864
/*
 
865
  Used only as parameter to multi_range_read_info():
 
866
  Flag set <=> the caller guarantees that the bounds of the scanned ranges
 
867
  will not have NULL values.
 
868
*/
 
869
#define HA_MRR_NO_NULL_ENDPOINTS 128
 
870
 
495
871
#endif /* DRIZZLE_SERVER_DEFINITIONS_H */