~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_lex.h

  • Committer: Monty Taylor
  • Date: 2009-05-22 17:09:30 UTC
  • mfrom: (1032 staging)
  • mto: This revision was merged to the branch mainline in revision 1036.
  • Revision ID: mordred@inaugust.com-20090522170930-tmcvwptt9udyocyo
MergedĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
 
80
80
typedef List<Item> List_item;
81
81
 
82
 
/* SERVERS CACHE CHANGES */
83
 
typedef struct st_lex_server_options
84
 
{
85
 
  int32_t port;
86
 
  uint32_t server_name_length;
87
 
  char *server_name, *host, *db, *username, *password, *scheme, *owner;
88
 
} LEX_SERVER_OPTIONS;
89
 
 
90
 
 
91
82
enum sub_select_type
92
83
{
93
 
  UNSPECIFIED_TYPE,UNION_TYPE, INTERSECT_TYPE,
94
 
  EXCEPT_TYPE, GLOBAL_OPTIONS_TYPE, DERIVED_TABLE_TYPE, OLAP_TYPE
 
84
  UNSPECIFIED_TYPE,
 
85
  UNION_TYPE,
 
86
  INTERSECT_TYPE,
 
87
  EXCEPT_TYPE,
 
88
  GLOBAL_OPTIONS_TYPE,
 
89
  DERIVED_TABLE_TYPE,
 
90
  OLAP_TYPE
95
91
};
96
92
 
97
93
enum olap_type
98
94
{
99
 
  UNSPECIFIED_OLAP_TYPE, CUBE_TYPE, ROLLUP_TYPE
 
95
  UNSPECIFIED_OLAP_TYPE,
 
96
  CUBE_TYPE,
 
97
  ROLLUP_TYPE
100
98
};
101
99
 
102
100
enum tablespace_op_type
103
101
{
104
 
  NO_TABLESPACE_OP, DISCARD_TABLESPACE, IMPORT_TABLESPACE
 
102
  NO_TABLESPACE_OP,
 
103
  DISCARD_TABLESPACE,
 
104
  IMPORT_TABLESPACE
105
105
};
106
106
 
107
107
/*
400
400
public:
401
401
  Name_resolution_context context;
402
402
  char *db;
403
 
  Item *where, *having;                         /* WHERE & HAVING clauses */
 
403
  /* An Item representing the WHERE clause */
 
404
  Item *where;
 
405
  /* An Item representing the HAVING clause */
 
406
  Item *having;
404
407
  /* Saved values of the WHERE and HAVING clauses*/
405
 
  Item::cond_result cond_value, having_value;
 
408
  Item::cond_result cond_value;
 
409
  Item::cond_result having_value;
406
410
  /* point on lex in which it was created, used in view subquery detection */
407
411
  LEX *parent_lex;
408
412
  enum olap_type olap;
409
413
  /* FROM clause - points to the beginning of the TableList::next_local list. */
410
 
  SQL_LIST            table_list;
411
 
  SQL_LIST            group_list; /* GROUP BY clause. */
412
 
  List<Item>          item_list;  /* list of fields & expressions */
413
 
  List<String>        interval_list;
414
 
  bool                is_item_list_lookup;
 
414
  SQL_LIST table_list;
 
415
  SQL_LIST group_list; /* GROUP BY clause. */
 
416
  List<Item> item_list;  /* list of fields & expressions */
 
417
  List<String> interval_list;
 
418
  bool is_item_list_lookup;
415
419
  JOIN *join; /* after JOIN::prepare it is pointer to corresponding JOIN */
416
420
  List<TableList> top_join_list; /* join list of the top level          */
417
421
  List<TableList> *join_list;    /* list for the currently parsed join  */
428
432
  SQL_LIST order_list;                /* ORDER clause */
429
433
  SQL_LIST *gorder_list;
430
434
  Item *select_limit, *offset_limit;  /* LIMIT clause parameters */
431
 
  // Arrays of pointers to top elements of all_fields list
 
435
  /* Arrays of pointers to top elements of all_fields list */
432
436
  Item **ref_pointer_array;
433
437
 
434
438
  /*
454
458
  int8_t nest_level;     /* nesting level of select */
455
459
  Item_sum *inner_sum_func_list; /* list of sum func in nested selects */
456
460
  uint32_t with_wild; /* item list contain '*' */
457
 
  bool  braces;         /* SELECT ... UNION (SELECT ... ) <- this braces */
 
461
  bool braces;          /* SELECT ... UNION (SELECT ... ) <- this braces */
458
462
  /* true when having fix field called in processing of this SELECT */
459
463
  bool having_fix_field;
460
464
  /* List of references to fields referenced from inner selects */
512
516
    return (Select_Lex_Unit*) slave;
513
517
  }
514
518
  Select_Lex* outer_select();
515
 
  Select_Lex* next_select() { return (Select_Lex*) next; }
 
519
  Select_Lex* next_select()
 
520
  {
 
521
    return (Select_Lex*) next;
 
522
  }
516
523
  Select_Lex* next_select_in_list()
517
524
  {
518
525
    return (Select_Lex*) link_next;
535
542
  bool add_item_to_list(Session *session, Item *item);
536
543
  bool add_group_to_list(Session *session, Item *item, bool asc);
537
544
  bool add_order_to_list(Session *session, Item *item, bool asc);
538
 
  TableList* add_table_to_list(Session *session, Table_ident *table,
539
 
                                LEX_STRING *alias,
540
 
                                uint32_t table_options,
541
 
                                thr_lock_type flags= TL_UNLOCK,
542
 
                                List<Index_hint> *hints= 0,
543
 
                                LEX_STRING *option= 0);
 
545
  TableList* add_table_to_list(Session *session,
 
546
                               Table_ident *table,
 
547
                               LEX_STRING *alias,
 
548
                               uint32_t table_options,
 
549
                               thr_lock_type flags= TL_UNLOCK,
 
550
                               List<Index_hint> *hints= 0,
 
551
                               LEX_STRING *option= 0);
544
552
  TableList* get_table_list();
545
553
  bool init_nested_join(Session *session);
546
554
  TableList *end_nested_join(Session *session);
562
570
    to LEX (LEX::unit & LEX::select, for other purposes there are
563
571
    Select_Lex_Unit::exclude_level & Select_Lex_Unit::exclude_tree
564
572
  */
565
 
  void cut_subtree() { slave= 0; }
 
573
  void cut_subtree()
 
574
  {
 
575
    slave= 0;
 
576
  }
566
577
  bool test_limit();
567
578
 
568
579
  friend void lex_start(Session *session);
655
666
class Alter_info
656
667
{
657
668
public:
658
 
  List<Alter_drop>              drop_list;
659
 
  List<Alter_column>            alter_list;
660
 
  List<Key>                     key_list;
661
 
  List<Create_field>            create_list;
662
 
  uint32_t                          flags;
663
 
  enum enum_enable_or_disable   keys_onoff;
664
 
  enum tablespace_op_type       tablespace_op;
665
 
  uint32_t                          no_parts;
666
 
  enum ha_build_method          build_method;
667
 
  Create_field                 *datetime_field;
668
 
  bool                          error_if_not_empty;
669
 
 
 
669
  List<Alter_drop> drop_list;
 
670
  List<Alter_column> alter_list;
 
671
  List<Key> key_list;
 
672
  List<Create_field> create_list;
 
673
  uint32_t flags;
 
674
  enum enum_enable_or_disable keys_onoff;
 
675
  enum tablespace_op_type tablespace_op;
 
676
  uint32_t no_parts;
 
677
  enum ha_build_method build_method;
 
678
  Create_field *datetime_field;
 
679
  bool error_if_not_empty;
670
680
 
671
681
  Alter_info() :
672
682
    flags(0),
698
708
  Alter_info(const Alter_info &rhs);            // not implemented
699
709
};
700
710
 
701
 
enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE,
702
 
                      XA_SUSPEND, XA_FOR_MIGRATE};
 
711
enum xa_option_words
 
712
{
 
713
  XA_NONE
 
714
, XA_JOIN
 
715
, XA_RESUME
 
716
, XA_ONE_PHASE
 
717
, XA_SUSPEND
 
718
, XA_FOR_MIGRATE
 
719
};
703
720
 
704
721
extern const LEX_STRING null_lex_str;
705
722
 
706
 
 
707
723
/*
708
724
  Class representing list of all tables used by statement.
709
725
  It also contains information about stored functions used by statement
714
730
  Also used by st_lex::reset_n_backup/restore_backup_query_tables_list()
715
731
  methods to save and restore this information.
716
732
*/
717
 
 
718
733
class Query_tables_list
719
734
{
720
735
public:
739
754
 
740
755
  /* Initializes (or resets) Query_tables_list object for "real" use. */
741
756
  void reset_query_tables_list(bool init);
742
 
  void set_query_tables_list(Query_tables_list *state)
743
 
  {
744
 
    *this= *state;
745
 
  }
746
757
 
747
758
  /*
748
759
    Direct addition to the list of query tables.
770
781
  }
771
782
};
772
783
 
773
 
 
774
 
/*
775
 
  st_parsing_options contains the flags for constructions that are
776
 
  allowed in the current statement.
777
 
*/
778
 
 
779
 
struct st_parsing_options
780
 
{
781
 
  bool allows_select_procedure;
782
 
 
783
 
  st_parsing_options() { reset(); }
784
 
  void reset();
785
 
};
786
 
 
787
 
 
788
784
/**
789
785
  The state of the lexical parser, when parsing comments.
790
786
*/
808
804
  DISCARD_COMMENT
809
805
};
810
806
 
811
 
 
812
 
/**
813
 
  @brief This class represents the character input stream consumed during
814
 
  lexical analysis.
815
 
 
816
 
  In addition to consuming the input stream, this class performs some
817
 
  comment pre processing, by filtering out out of bound special text
818
 
  from the query input stream.
819
 
  Two buffers, with pointers inside each buffers, are maintained in
820
 
  parallel. The 'raw' buffer is the original query text, which may
821
 
  contain out-of-bound comments. The 'cpp' (for comments pre processor)
822
 
  is the pre-processed buffer that contains only the query text that
823
 
  should be seen once out-of-bound data is removed.
824
 
*/
825
 
 
826
 
class Lex_input_stream
827
 
{
828
 
public:
829
 
  Lex_input_stream(Session *session, const char* buff, unsigned int length);
830
 
  ~Lex_input_stream();
831
 
 
832
 
  /**
833
 
    Set the echo mode.
834
 
 
835
 
    When echo is true, characters parsed from the raw input stream are
836
 
    preserved. When false, characters parsed are silently ignored.
837
 
    @param echo the echo mode.
838
 
  */
839
 
  void set_echo(bool echo)
840
 
  {
841
 
    m_echo= echo;
842
 
  }
843
 
 
844
 
  /**
845
 
    Skip binary from the input stream.
846
 
    @param n number of bytes to accept.
847
 
  */
848
 
  void skip_binary(int n)
849
 
  {
850
 
    if (m_echo)
851
 
    {
852
 
      memcpy(m_cpp_ptr, m_ptr, n);
853
 
      m_cpp_ptr += n;
854
 
    }
855
 
    m_ptr += n;
856
 
  }
857
 
 
858
 
  /**
859
 
    Get a character, and advance in the stream.
860
 
    @return the next character to parse.
861
 
  */
862
 
  char yyGet()
863
 
  {
864
 
    char c= *m_ptr++;
865
 
    if (m_echo)
866
 
      *m_cpp_ptr++ = c;
867
 
    return c;
868
 
  }
869
 
 
870
 
  /**
871
 
    Get the last character accepted.
872
 
    @return the last character accepted.
873
 
  */
874
 
  char yyGetLast()
875
 
  {
876
 
    return m_ptr[-1];
877
 
  }
878
 
 
879
 
  /**
880
 
    Look at the next character to parse, but do not accept it.
881
 
  */
882
 
  char yyPeek()
883
 
  {
884
 
    return m_ptr[0];
885
 
  }
886
 
 
887
 
  /**
888
 
    Look ahead at some character to parse.
889
 
    @param n offset of the character to look up
890
 
  */
891
 
  char yyPeekn(int n)
892
 
  {
893
 
    return m_ptr[n];
894
 
  }
895
 
 
896
 
  /**
897
 
    Cancel the effect of the last yyGet() or yySkip().
898
 
    Note that the echo mode should not change between calls to yyGet / yySkip
899
 
    and yyUnget. The caller is responsible for ensuring that.
900
 
  */
901
 
  void yyUnget()
902
 
  {
903
 
    m_ptr--;
904
 
    if (m_echo)
905
 
      m_cpp_ptr--;
906
 
  }
907
 
 
908
 
  /**
909
 
    Accept a character, by advancing the input stream.
910
 
  */
911
 
  void yySkip()
912
 
  {
913
 
    if (m_echo)
914
 
      *m_cpp_ptr++ = *m_ptr++;
915
 
    else
916
 
      m_ptr++;
917
 
  }
918
 
 
919
 
  /**
920
 
    Accept multiple characters at once.
921
 
    @param n the number of characters to accept.
922
 
  */
923
 
  void yySkipn(int n)
924
 
  {
925
 
    if (m_echo)
926
 
    {
927
 
      memcpy(m_cpp_ptr, m_ptr, n);
928
 
      m_cpp_ptr += n;
929
 
    }
930
 
    m_ptr += n;
931
 
  }
932
 
 
933
 
  /**
934
 
    End of file indicator for the query text to parse.
935
 
    @return true if there are no more characters to parse
936
 
  */
937
 
  bool eof()
938
 
  {
939
 
    return (m_ptr >= m_end_of_query);
940
 
  }
941
 
 
942
 
  /**
943
 
    End of file indicator for the query text to parse.
944
 
    @param n number of characters expected
945
 
    @return true if there are less than n characters to parse
946
 
  */
947
 
  bool eof(int n)
948
 
  {
949
 
    return ((m_ptr + n) >= m_end_of_query);
950
 
  }
951
 
 
952
 
  /** Get the raw query buffer. */
953
 
  const char *get_buf()
954
 
  {
955
 
    return m_buf;
956
 
  }
957
 
 
958
 
  /** Get the pre-processed query buffer. */
959
 
  const char *get_cpp_buf()
960
 
  {
961
 
    return m_cpp_buf;
962
 
  }
963
 
 
964
 
  /** Get the end of the raw query buffer. */
965
 
  const char *get_end_of_query()
966
 
  {
967
 
    return m_end_of_query;
968
 
  }
969
 
 
970
 
  /** Mark the stream position as the start of a new token. */
971
 
  void start_token()
972
 
  {
973
 
    m_tok_start_prev= m_tok_start;
974
 
    m_tok_start= m_ptr;
975
 
    m_tok_end= m_ptr;
976
 
 
977
 
    m_cpp_tok_start_prev= m_cpp_tok_start;
978
 
    m_cpp_tok_start= m_cpp_ptr;
979
 
    m_cpp_tok_end= m_cpp_ptr;
980
 
  }
981
 
 
982
 
  /**
983
 
    Adjust the starting position of the current token.
984
 
    This is used to compensate for starting whitespace.
985
 
  */
986
 
  void restart_token()
987
 
  {
988
 
    m_tok_start= m_ptr;
989
 
    m_cpp_tok_start= m_cpp_ptr;
990
 
  }
991
 
 
992
 
  /** Get the token start position, in the raw buffer. */
993
 
  const char *get_tok_start()
994
 
  {
995
 
    return m_tok_start;
996
 
  }
997
 
 
998
 
  /** Get the token start position, in the pre-processed buffer. */
999
 
  const char *get_cpp_tok_start()
1000
 
  {
1001
 
    return m_cpp_tok_start;
1002
 
  }
1003
 
 
1004
 
  /** Get the token end position, in the raw buffer. */
1005
 
  const char *get_tok_end()
1006
 
  {
1007
 
    return m_tok_end;
1008
 
  }
1009
 
 
1010
 
  /** Get the token end position, in the pre-processed buffer. */
1011
 
  const char *get_cpp_tok_end()
1012
 
  {
1013
 
    return m_cpp_tok_end;
1014
 
  }
1015
 
 
1016
 
  /** Get the previous token start position, in the raw buffer. */
1017
 
  const char *get_tok_start_prev()
1018
 
  {
1019
 
    return m_tok_start_prev;
1020
 
  }
1021
 
 
1022
 
  /** Get the current stream pointer, in the raw buffer. */
1023
 
  const char *get_ptr()
1024
 
  {
1025
 
    return m_ptr;
1026
 
  }
1027
 
 
1028
 
  /** Get the current stream pointer, in the pre-processed buffer. */
1029
 
  const char *get_cpp_ptr()
1030
 
  {
1031
 
    return m_cpp_ptr;
1032
 
  }
1033
 
 
1034
 
  /** Get the length of the current token, in the raw buffer. */
1035
 
  uint32_t yyLength()
1036
 
  {
1037
 
    /*
1038
 
      The assumption is that the lexical analyser is always 1 character ahead,
1039
 
      which the -1 account for.
1040
 
    */
1041
 
    assert(m_ptr > m_tok_start);
1042
 
    return (uint32_t) ((m_ptr - m_tok_start) - 1);
1043
 
  }
1044
 
 
1045
 
  /** Get the utf8-body string. */
1046
 
  const char *get_body_utf8_str()
1047
 
  {
1048
 
    return m_body_utf8;
1049
 
  }
1050
 
 
1051
 
  /** Get the utf8-body length. */
1052
 
  uint32_t get_body_utf8_length()
1053
 
  {
1054
 
    return m_body_utf8_ptr - m_body_utf8;
1055
 
  }
1056
 
 
1057
 
  void body_utf8_start(Session *session, const char *begin_ptr);
1058
 
  void body_utf8_append(const char *ptr);
1059
 
  void body_utf8_append(const char *ptr, const char *end_ptr);
1060
 
  void body_utf8_append_literal(Session *session,
1061
 
                                const LEX_STRING *txt,
1062
 
                                const CHARSET_INFO * const txt_cs,
1063
 
                                const char *end_ptr);
1064
 
 
1065
 
  /** Current thread. */
1066
 
  Session *m_session;
1067
 
 
1068
 
  /** Current line number. */
1069
 
  uint32_t yylineno;
1070
 
 
1071
 
  /** Length of the last token parsed. */
1072
 
  uint32_t yytoklen;
1073
 
 
1074
 
  /** Interface with bison, value of the last token parsed. */
1075
 
  LEX_YYSTYPE yylval;
1076
 
 
1077
 
  /** LALR(2) resolution, look ahead token.*/
1078
 
  int lookahead_token;
1079
 
 
1080
 
  /** LALR(2) resolution, value of the look ahead token.*/
1081
 
  LEX_YYSTYPE lookahead_yylval;
1082
 
 
1083
 
private:
1084
 
  /** Pointer to the current position in the raw input stream. */
1085
 
  const char *m_ptr;
1086
 
 
1087
 
  /** Starting position of the last token parsed, in the raw buffer. */
1088
 
  const char *m_tok_start;
1089
 
 
1090
 
  /** Ending position of the previous token parsed, in the raw buffer. */
1091
 
  const char *m_tok_end;
1092
 
 
1093
 
  /** End of the query text in the input stream, in the raw buffer. */
1094
 
  const char *m_end_of_query;
1095
 
 
1096
 
  /** Starting position of the previous token parsed, in the raw buffer. */
1097
 
  const char *m_tok_start_prev;
1098
 
 
1099
 
  /** Begining of the query text in the input stream, in the raw buffer. */
1100
 
  const char *m_buf;
1101
 
 
1102
 
  /** Length of the raw buffer. */
1103
 
  uint32_t m_buf_length;
1104
 
 
1105
 
  /** Echo the parsed stream to the pre-processed buffer. */
1106
 
  bool m_echo;
1107
 
 
1108
 
  /** Pre-processed buffer. */
1109
 
  char *m_cpp_buf;
1110
 
 
1111
 
  /** Pointer to the current position in the pre-processed input stream. */
1112
 
  char *m_cpp_ptr;
1113
 
 
1114
 
  /**
1115
 
    Starting position of the last token parsed,
1116
 
    in the pre-processed buffer.
1117
 
  */
1118
 
  const char *m_cpp_tok_start;
1119
 
 
1120
 
  /**
1121
 
    Starting position of the previous token parsed,
1122
 
    in the pre-procedded buffer.
1123
 
  */
1124
 
  const char *m_cpp_tok_start_prev;
1125
 
 
1126
 
  /**
1127
 
    Ending position of the previous token parsed,
1128
 
    in the pre-processed buffer.
1129
 
  */
1130
 
  const char *m_cpp_tok_end;
1131
 
 
1132
 
  /** UTF8-body buffer created during parsing. */
1133
 
  char *m_body_utf8;
1134
 
 
1135
 
  /** Pointer to the current position in the UTF8-body buffer. */
1136
 
  char *m_body_utf8_ptr;
1137
 
 
1138
 
  /**
1139
 
    Position in the pre-processed buffer. The query from m_cpp_buf to
1140
 
    m_cpp_utf_processed_ptr is converted to UTF8-body.
1141
 
  */
1142
 
  const char *m_cpp_utf8_processed_ptr;
1143
 
 
1144
 
public:
1145
 
 
1146
 
  /** Current state of the lexical analyser. */
1147
 
  enum my_lex_states next_state;
1148
 
 
1149
 
  /**
1150
 
    Position of ';' in the stream, to delimit multiple queries.
1151
 
    This delimiter is in the raw buffer.
1152
 
  */
1153
 
  const char *found_semicolon;
1154
 
 
1155
 
  /** Token character bitmaps, to detect 7bit strings. */
1156
 
  unsigned char tok_bitmap;
1157
 
 
1158
 
  /** SQL_MODE = IGNORE_SPACE. */
1159
 
  bool ignore_space;
1160
 
 
1161
 
  /** State of the lexical analyser for comments. */
1162
 
  enum_comment_state in_comment;
1163
 
 
1164
 
  /**
1165
 
    Starting position of the TEXT_STRING or IDENT in the pre-processed
1166
 
    buffer.
1167
 
 
1168
 
    NOTE: this member must be used within DRIZZLElex() function only.
1169
 
  */
1170
 
  const char *m_cpp_text_start;
1171
 
 
1172
 
  /**
1173
 
    Ending position of the TEXT_STRING or IDENT in the pre-processed
1174
 
    buffer.
1175
 
 
1176
 
    NOTE: this member must be used within DRIZZLElex() function only.
1177
 
    */
1178
 
  const char *m_cpp_text_end;
1179
 
 
1180
 
  /**
1181
 
    Character set specified by the character-set-introducer.
1182
 
 
1183
 
    NOTE: this member must be used within DRIZZLElex() function only.
1184
 
  */
1185
 
  const CHARSET_INFO *m_underscore_cs;
1186
 
};
1187
 
 
 
807
#include "drizzled/lex_input_stream.h"
1188
808
 
1189
809
/* The state of the lex parsing. This is saved in the Session struct */
1190
 
 
1191
810
class LEX : public Query_tables_list
1192
811
{
1193
812
public:
1198
817
  /* list of all Select_Lex */
1199
818
  Select_Lex *all_selects_list;
1200
819
 
1201
 
  char *length,*dec,*change;
 
820
  /* This is the "scale" for DECIMAL (S,P) notation */ 
 
821
  char *length;
 
822
  /* This is the decimal precision in DECIMAL(S,P) notation */
 
823
  char *dec;
 
824
  /* The text in a CHANGE COLUMN clause in ALTER TABLE */
 
825
  char *change;
 
826
  
 
827
  /**
 
828
   * This is used kind of like the "ident" member variable below, as 
 
829
   * a place to store certain names of identifiers.  Unfortunately, it
 
830
   * is used differently depending on the Command (SELECT on a derived
 
831
   * table vs CREATE)
 
832
   */
1202
833
  LEX_STRING name;
 
834
  /* The string literal used in a LIKE expression */
1203
835
  String *wild;
1204
836
  file_exchange *exchange;
1205
837
  select_result *result;
1206
 
  Item *default_value, *on_update_value;
1207
 
  LEX_STRING comment, ident;
1208
 
  XID *xid;
 
838
 
 
839
  /* An item representing the DEFAULT clause in CREATE/ALTER TABLE */
 
840
  Item *default_value;
 
841
  /* An item representing the ON UPDATE clause in CREATE/ALTER TABLE */
 
842
  Item *on_update_value;
 
843
  /* Not really sure what exactly goes in here... Comment text at beginning of statement? */
 
844
  LEX_STRING comment;
 
845
 
 
846
  /**
 
847
   * This is current used to store the name of a named key cache
 
848
   * or a named savepoint.  It should probably be refactored out into
 
849
   * the eventual Command class built for the Keycache and Savepoint
 
850
   * commands.
 
851
   */ 
 
852
  LEX_STRING ident;
 
853
 
1209
854
  unsigned char* yacc_yyss, *yacc_yyvs;
 
855
  /* The owning Session of this LEX */
1210
856
  Session *session;
1211
 
 
1212
857
  const CHARSET_INFO *charset;
1213
858
  bool text_string_is_7bit;
1214
859
  /* store original leaf_tables for INSERT SELECT and PS/SP */
1236
881
    required a local context, the parser pops the top-most context.
1237
882
  */
1238
883
  List<Name_resolution_context> context_stack;
1239
 
  List<LEX_STRING>     db_list;
1240
884
 
1241
 
  SQL_LIST            auxiliary_table_list, save_list;
1242
 
  Create_field        *last_field;
 
885
  SQL_LIST auxiliary_table_list;
 
886
  SQL_LIST save_list;
 
887
  Create_field *last_field;
1243
888
  Item_sum *in_sum_func;
1244
889
  Function_builder *udf;
1245
 
  HA_CHECK_OPT   check_opt;                     // check/repair options
 
890
  HA_CHECK_OPT check_opt;                       // check/repair options
1246
891
  HA_CREATE_INFO create_info;
1247
892
  KEY_CREATE_INFO key_create_info;
1248
893
  uint32_t type;
1276
921
  };
1277
922
  enum enum_var_type option_type;
1278
923
 
1279
 
  uint32_t profile_query_id;
1280
 
  uint32_t profile_options;
1281
924
  enum column_format_type column_format;
1282
 
  uint32_t which_columns;
1283
925
  enum Foreign_key::fk_match_opt fk_match_option;
1284
926
  enum Foreign_key::fk_option fk_update_opt;
1285
927
  enum Foreign_key::fk_option fk_delete_opt;
1286
 
  uint32_t slave_session_opt, start_transaction_opt;
 
928
  /* Options used in START TRANSACTION statement */
 
929
  uint32_t start_transaction_opt;
1287
930
  int nest_level;
1288
931
  /*
1289
932
    In LEX representing update which were transformed to multi-update
1297
940
    query (0 if no derived tables, otherwise DERIVED_SUBQUERY).
1298
941
  */
1299
942
  uint8_t derived_tables;
1300
 
  bool drop_if_exists, drop_temporary, one_shot_set;
1301
 
  bool autocommit;
 
943
 
 
944
  /* True if "IF EXISTS" used in DROP statement */
 
945
  bool drop_if_exists;
 
946
  /* True if "TEMPORARY" used in DROP/CREATE statement */
 
947
  bool drop_temporary;
 
948
  bool one_shot_set;
 
949
 
 
950
  /* Only true when FULL symbol is found (e.g. SHOW FULL PROCESSLIST) */
1302
951
  bool verbose;
1303
 
 
1304
 
  bool tx_chain, tx_release;
1305
 
  bool subqueries, ignore;
1306
 
  st_parsing_options parsing_options;
 
952
  
 
953
  /* Was the CHAIN option using in COMMIT/ROLLBACK? */
 
954
  bool tx_chain;
 
955
  /* Was the RELEASE option used in COMMIT/ROLLBACK? */
 
956
  bool tx_release;
 
957
  /* Was the IGNORE symbol found in statement */
 
958
  bool ignore;
1307
959
  Alter_info alter_info;
1308
960
 
1309
961
  /*
1321
973
  */
1322
974
  bool use_only_table_context;
1323
975
 
 
976
  /* Was the ESCAPE keyword used? */
1324
977
  bool escape_used;
1325
978
  bool is_lex_started; /* If lex_start() did run. For debugging. */
1326
979
 
1385
1038
 
1386
1039
extern void lex_start(Session *session);
1387
1040
extern void lex_end(LEX *lex);
1388
 
 
1389
1041
extern void trim_whitespace(const CHARSET_INFO * const cs, LEX_STRING *str);
1390
 
 
1391
1042
extern bool is_lex_native_function(const LEX_STRING *name);
1392
1043
 
1393
1044
/**