~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/definitions.h

  • Committer: Brian Aker
  • Date: 2009-07-11 19:23:04 UTC
  • mfrom: (1089.1.14 merge)
  • Revision ID: brian@gaz-20090711192304-ootijyl5yf9jq9kd
Merge Brian

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#ifndef DRIZZLE_SERVER_DEFINITIONS_H
27
27
#define DRIZZLE_SERVER_DEFINITIONS_H
28
28
 
 
29
#include <drizzled/enum.h>
 
30
 
29
31
#include <stdint.h>
30
32
 
31
33
/* These paths are converted to other systems (WIN95) before use */
338
340
#define IS_EQUAL_PACK_LENGTH 2
339
341
 
340
342
 
341
 
/**
342
 
  Query type constants.
343
 
 
344
 
  QT_ORDINARY -- ordinary SQL query.
345
 
  QT_IS -- SQL query to be shown in INFORMATION_SCHEMA (in utf8 and without
346
 
  character set introducers).
347
 
 
348
 
  @TODO
349
 
 
350
 
  Move this out of here once Stew's done with UDF breakout.  The following headers need it:
351
 
 
352
 
    sql_lex.h --> included by session.h
353
 
    item.h
354
 
    table.h
355
 
    item_func.h
356
 
    item_subselect.h
357
 
    item_timefunc.h
358
 
    item_sum.h
359
 
    item_cmpfunc.h
360
 
    item_strfunc.h
361
 
*/
362
 
enum enum_query_type
363
 
{
364
 
  QT_ORDINARY,
365
 
  QT_IS
366
 
};
367
 
 
368
 
 
369
 
/**
370
 
 * @TODO Move to a separate header?
371
 
 *
372
 
 * It's needed by item.h and field.h, which are both inter-dependent
373
 
 * and contain forward declarations of many structs/classes in the
374
 
 * other header file.
375
 
 *
376
 
 * What is needed is a separate header file that is included
377
 
 * by *both* item.h and field.h to resolve inter-dependencies
378
 
 *
379
 
 * But, probably want to hold off on this until Stew finished the UDF cleanup
380
 
 */
381
 
enum Derivation
382
 
{
383
 
  DERIVATION_IGNORABLE= 5,
384
 
  DERIVATION_COERCIBLE= 4,
385
 
  DERIVATION_SYSCONST= 3,
386
 
  DERIVATION_IMPLICIT= 2,
387
 
  DERIVATION_NONE= 1,
388
 
  DERIVATION_EXPLICIT= 0
389
 
};
390
 
 
391
 
/**
392
 
 * Opening modes for open_temporary_table and open_table_from_share
393
 
 *
394
 
 * @TODO Put this into an appropriate header. It is only needed in:
395
 
 *
396
 
 *    table.cc
397
 
 *    sql_base.cc
398
 
 */
399
 
enum open_table_mode
400
 
{
401
 
  OTM_OPEN= 0,
402
 
  OTM_CREATE= 1,
403
 
  OTM_ALTER= 2
404
 
};
405
 
 
406
 
enum enum_parsing_place
407
 
{
408
 
  NO_MATTER
409
 
  , IN_HAVING
410
 
  , SELECT_LIST
411
 
  , IN_WHERE
412
 
  , IN_ON
413
 
};
414
 
 
415
 
enum enum_mysql_completiontype {
416
 
  ROLLBACK_RELEASE= -2
417
 
  , ROLLBACK= 1
418
 
  , ROLLBACK_AND_CHAIN= 7
419
 
  , COMMIT_RELEASE= -1
420
 
  , COMMIT= 0
421
 
  , COMMIT_AND_CHAIN= 6
422
 
};
423
 
 
424
 
enum enum_check_fields
425
 
{
426
 
  CHECK_FIELD_IGNORE
427
 
  , CHECK_FIELD_WARN
428
 
  , CHECK_FIELD_ERROR_FOR_NULL
429
 
};
430
 
 
431
 
enum enum_var_type
432
 
{
433
 
  OPT_DEFAULT= 0
434
 
  , OPT_SESSION
435
 
  , OPT_GLOBAL
436
 
};
437
 
 
438
 
 
439
343
typedef uint64_t query_id_t;
440
344
typedef void *range_seq_t;
441
345
 
601
505
#define HA_CHECK_DUP_UNIQUE 2
602
506
#define HA_CHECK_DUP (HA_CHECK_DUP_KEY + HA_CHECK_DUP_UNIQUE)
603
507
 
604
 
enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
605
 
                ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED,
606
 
                ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT, ROW_TYPE_PAGE };
607
 
 
608
 
enum column_format_type { COLUMN_FORMAT_TYPE_NOT_USED= -1,
609
 
                          COLUMN_FORMAT_TYPE_DEFAULT=   0,
610
 
                          COLUMN_FORMAT_TYPE_FIXED=     1,
611
 
                          COLUMN_FORMAT_TYPE_DYNAMIC=   2 };
612
 
 
613
 
/* struct to hold information about the table that should be created */
614
508
 
615
509
/* Bits in used_fields */
616
510
#define HA_CREATE_USED_AUTO             (1L << 0)
640
534
#define MAXGTRIDSIZE 64
641
535
#define MAXBQUALSIZE 64
642
536
 
643
 
enum ha_choice { HA_CHOICE_UNDEF, HA_CHOICE_NO, HA_CHOICE_YES };
644
 
 
645
537
/*
646
538
  The below two are not used (and not handled) in this milestone of this WL
647
539
  entry because there seems to be no use for them at this stage of
687
579
*/
688
580
#define HA_MRR_NO_NULL_ENDPOINTS 128
689
581
 
690
 
enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME };
691
 
 
692
 
enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED,
693
 
                         ISO_REPEATABLE_READ, ISO_SERIALIZABLE};
694
 
 
695
 
 
696
 
enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED};
697
 
 
698
582
typedef int myf;
699
583
#define MYF(v)          (myf) (v)
700
584
 
701
 
/*
702
 
  When a command is added here, be sure it's also added in mysqld.cc
703
 
  in "struct show_var_st status_vars[]= {" ...
704
 
 
705
 
  If the command returns a result set or is not allowed in stored
706
 
  functions or triggers, please also make sure that
707
 
  sp_get_flags_for_command (sp_head.cc) returns proper flags for the
708
 
  added SQLCOM_.
709
 
*/
710
 
 
711
 
enum enum_sql_command {
712
 
  SQLCOM_SELECT, SQLCOM_CREATE_TABLE, SQLCOM_CREATE_INDEX, SQLCOM_ALTER_TABLE,
713
 
  SQLCOM_UPDATE, SQLCOM_INSERT, SQLCOM_INSERT_SELECT,
714
 
  SQLCOM_DELETE, SQLCOM_TRUNCATE, SQLCOM_DROP_TABLE, SQLCOM_DROP_INDEX,
715
 
  SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
716
 
  SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_STATUS,
717
 
  SQLCOM_SHOW_ENGINE_STATUS, SQLCOM_SHOW_ENGINE_MUTEX,
718
 
  SQLCOM_SHOW_PROCESSLIST,
719
 
  SQLCOM_SHOW_CREATE,
720
 
  SQLCOM_SHOW_CREATE_DB,
721
 
  SQLCOM_SHOW_TABLE_STATUS,
722
 
  SQLCOM_LOAD,
723
 
  SQLCOM_SET_OPTION,
724
 
  SQLCOM_UNLOCK_TABLES,
725
 
  SQLCOM_CHANGE_DB, SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB,
726
 
  SQLCOM_REPLACE, SQLCOM_REPLACE_SELECT,
727
 
  SQLCOM_OPTIMIZE, SQLCOM_CHECK,
728
 
  SQLCOM_ASSIGN_TO_KEYCACHE,
729
 
  SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_ANALYZE,
730
 
  SQLCOM_ROLLBACK, SQLCOM_ROLLBACK_TO_SAVEPOINT,
731
 
  SQLCOM_COMMIT, SQLCOM_SAVEPOINT, SQLCOM_RELEASE_SAVEPOINT,
732
 
  SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP,
733
 
  SQLCOM_BEGIN,
734
 
  SQLCOM_RENAME_TABLE,
735
 
  SQLCOM_SHOW_OPEN_TABLES,
736
 
  SQLCOM_DELETE_MULTI, SQLCOM_UPDATE_MULTI,
737
 
  SQLCOM_SHOW_WARNS,
738
 
  SQLCOM_EMPTY_QUERY,
739
 
  SQLCOM_SHOW_ERRORS,
740
 
  SQLCOM_CHECKSUM,
741
 
  SQLCOM_SHOW_PLUGINS,
742
 
  /*
743
 
    When a command is added here, be sure it's also added in mysqld.cc
744
 
    in "struct show_var_st status_vars[]= {" ...
745
 
  */
746
 
  /* This should be the last !!! */
747
 
  SQLCOM_END
748
 
};
749
 
 
750
 
enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_UPDATE };
751
 
 
752
585
#define MY_I_S_MAYBE_NULL 1
753
586
#define MY_I_S_UNSIGNED   2
754
587
 
778
611
#define MY_COLL_ALLOW_CONV            3
779
612
#define MY_COLL_DISALLOW_NONE         4
780
613
#define MY_COLL_CMP_CONV              7
781
 
 
782
 
 
783
 
enum tmp_table_type
784
 
{
785
 
  NO_TMP_TABLE, NON_TRANSACTIONAL_TMP_TABLE, TRANSACTIONAL_TMP_TABLE,
786
 
  INTERNAL_TMP_TABLE, SYSTEM_TMP_TABLE, TMP_TABLE_FRM_FILE_ONLY
787
 
};
788
 
 
789
 
/*
790
 
  Values in this enum are used to indicate how a tables TIMESTAMP field
791
 
  should be treated. It can be set to the current timestamp on insert or
792
 
  update or both.
793
 
  WARNING: The values are used for bit operations. If you change the
794
 
  enum, you must keep the bitwise relation of the values. For example:
795
 
  (int) TIMESTAMP_AUTO_SET_ON_BOTH must be equal to
796
 
  (int) TIMESTAMP_AUTO_SET_ON_INSERT | (int) TIMESTAMP_AUTO_SET_ON_UPDATE.
797
 
  We use an enum here so that the debugger can display the value names.
798
 
*/
799
 
enum timestamp_auto_set_type
800
 
{
801
 
  TIMESTAMP_NO_AUTO_SET= 0, TIMESTAMP_AUTO_SET_ON_INSERT= 1,
802
 
  TIMESTAMP_AUTO_SET_ON_UPDATE= 2, TIMESTAMP_AUTO_SET_ON_BOTH= 3
803
 
};
804
614
#define clear_timestamp_auto_bits(_target_, _bits_) \
805
615
  (_target_)= (enum timestamp_auto_set_type)((int)(_target_) & ~(int)(_bits_))
806
616
 
807
 
/**
808
 
  Category of table found in the table share.
809
 
*/
810
 
enum enum_table_category
811
 
{
812
 
  /**
813
 
    Unknown value.
814
 
  */
815
 
  TABLE_UNKNOWN_CATEGORY=0,
816
 
 
817
 
  /**
818
 
    Temporary table.
819
 
    The table is visible only in the session.
820
 
    Therefore,
821
 
    - FLUSH TABLES WITH READ LOCK
822
 
    - SET GLOBAL READ_ONLY = ON
823
 
    do not apply to this table.
824
 
    Note that LOCK Table t FOR READ/WRITE
825
 
    can be used on temporary tables.
826
 
    Temporary tables are not part of the table cache.
827
 
  */
828
 
  TABLE_CATEGORY_TEMPORARY=1,
829
 
 
830
 
  /**
831
 
    User table.
832
 
    These tables do honor:
833
 
    - LOCK Table t FOR READ/WRITE
834
 
    - FLUSH TABLES WITH READ LOCK
835
 
    - SET GLOBAL READ_ONLY = ON
836
 
    User tables are cached in the table cache.
837
 
  */
838
 
  TABLE_CATEGORY_USER=2,
839
 
 
840
 
  /**
841
 
    Information schema tables.
842
 
    These tables are an interface provided by the system
843
 
    to inspect the system metadata.
844
 
    These tables do *not* honor:
845
 
    - LOCK Table t FOR READ/WRITE
846
 
    - FLUSH TABLES WITH READ LOCK
847
 
    - SET GLOBAL READ_ONLY = ON
848
 
    as there is no point in locking explicitely
849
 
    an INFORMATION_SCHEMA table.
850
 
    Nothing is directly written to information schema tables.
851
 
    Note that this value is not used currently,
852
 
    since information schema tables are not shared,
853
 
    but implemented as session specific temporary tables.
854
 
  */
855
 
  /*
856
 
    TODO: Fixing the performance issues of I_S will lead
857
 
    to I_S tables in the table cache, which should use
858
 
    this table type.
859
 
  */
860
 
  TABLE_CATEGORY_INFORMATION
861
 
};
862
 
 
863
 
enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
864
 
enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON,
865
 
                            DELAY_KEY_WRITE_ALL };
866
 
enum enum_mark_columns
867
 
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
868
 
 
869
 
enum enum_filetype { FILETYPE_CSV, FILETYPE_XML };
870
 
 
871
 
enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND,
872
 
                                  IGNORE_ERRORS, REPORT_EXCEPT_NON_UNIQUE,
873
 
                                  IGNORE_EXCEPT_NON_UNIQUE};
874
 
 
875
 
enum enum_schema_table_state
876
 
{
877
 
  NOT_PROCESSED= 0,
878
 
  PROCESSED_BY_CREATE_SORT_INDEX,
879
 
  PROCESSED_BY_JOIN_EXEC
880
 
};
881
 
 
882
617
/*
883
618
 * The following are for the interface with the .frm file
884
619
 */