~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
** The type will be void*, so it must be  cast to (Session*) when used.
26
26
** Use the YYSession macro for this.
27
27
*/
28
 
 
29
 
#define YYSession (session)
 
28
#define YYPARSE_PARAM yysession
 
29
#define YYLEX_PARAM yysession
 
30
#define YYSession (static_cast<Session *>(yysession))
30
31
 
31
32
#define YYENABLE_NLS 0
32
33
#define YYLTYPE_IS_TRIVIAL 0
33
34
 
 
35
#define DRIZZLE_YACC
34
36
#define YYINITDEPTH 100
35
37
#define YYMAXDEPTH 3200                        /* Because of 64K stack */
36
 
#define Lex (session->getLex())
 
38
#define Lex (YYSession->lex)
37
39
 
38
 
#include <config.h>
 
40
#include "config.h"
39
41
#include <cstdio>
40
 
#include <drizzled/parser.h>
 
42
#include "drizzled/parser.h"
41
43
 
42
 
int yylex(union ParserType *yylval, drizzled::Session *session);
 
44
int yylex(void *yylval, void *yysession);
43
45
 
44
46
#define yyoverflow(A,B,C,D,E,F)               \
45
47
  {                                           \
46
48
    unsigned long val= *(F);                          \
47
49
    if (drizzled::my_yyoverflow((B), (D), &val)) \
48
50
    {                                         \
49
 
      yyerror(NULL, (char*) (A));                   \
 
51
      yyerror((char*) (A));                   \
50
52
      return 2;                               \
51
53
    }                                         \
52
54
    else                                      \
68
70
    DRIZZLE_YYABORT;                      \
69
71
  }
70
72
 
 
73
 
 
74
#define YYDEBUG 0
 
75
 
71
76
namespace drizzled
72
77
{
73
78
 
103
108
  to abort from the parser.
104
109
*/
105
110
 
106
 
static void base_sql_error(drizzled::Session *session, const char *s)
 
111
static void DRIZZLEerror(const char *s)
107
112
{
108
 
  parser::errorOn(session, s);
 
113
  parser::errorOn(s);
109
114
}
110
115
 
111
116
} /* namespace drizzled; */
112
117
 
113
118
using namespace drizzled;
114
119
%}
115
 
%union ParserType {
 
120
%union {
116
121
  bool boolean;
117
122
  int  num;
118
123
  unsigned long ulong_num;
156
161
%{
157
162
namespace drizzled
158
163
{
159
 
bool my_yyoverflow(short **a, union ParserType **b, unsigned long *yystacksize);
 
164
bool my_yyoverflow(short **a, YYSTYPE **b, unsigned long *yystacksize);
160
165
}
161
166
%}
162
167
 
163
168
%debug
164
 
%require "2.2"
165
 
%pure-parser
166
 
%name-prefix="base_sql_"
167
 
%parse-param { drizzled::Session *session }
168
 
%lex-param { drizzled::Session *session }
169
 
%verbose
170
 
 
 
169
%pure_parser                                    /* We have threads */
171
170
 
172
171
/*
173
172
  Currently there are 70 shift/reduce conflicts.
298
297
%token  END_OF_INPUT                  /* INTERNAL */
299
298
%token  ENGINE_SYM
300
299
%token  ENUM_SYM
 
300
%token  EQ                            /* OPERATOR */
301
301
%token  EQUAL_SYM                     /* OPERATOR */
302
302
%token  ERRORS
303
303
%token  ESCAPED
324
324
%token  GLOBAL_SYM                    /* SQL-2003-R */
325
325
%token  GROUP_SYM                     /* SQL-2003-R */
326
326
%token  GROUP_CONCAT_SYM
 
327
%token  GT_SYM                        /* OPERATOR */
327
328
%token  HASH_SYM
328
329
%token  HAVING                        /* SQL-2003-R */
329
330
%token  HEX_NUM
373
374
%token  LOGS_SYM
374
375
%token  LONG_NUM
375
376
%token  LONG_SYM
 
377
%token  LT                            /* OPERATOR */
376
378
%token  MATCH                         /* SQL-2003-R */
377
379
%token  MAX_SYM                       /* SQL-2003-N */
378
380
%token  MAX_VALUE_SYM                 /* SQL-2003-N */
393
395
%token  NATIONAL_SYM                  /* SQL-2003-R */
394
396
%token  NATURAL                       /* SQL-2003-R */
395
397
%token  NE                            /* OPERATOR */
 
398
%token  NEG
396
399
%token  NEW_SYM                       /* SQL-2003-R */
397
400
%token  NEXT_SYM                      /* SQL-2003-N */
398
401
%token  NONE_SYM                      /* SQL-2003-R */
439
442
%token  REPEATABLE_SYM                /* SQL-2003-N */
440
443
%token  REPEAT_SYM                    /* MYSQL-FUNC */
441
444
%token  REPLACE                       /* MYSQL-FUNC */
442
 
%token  REPLICATION
443
445
%token  RESTRICT
444
446
%token  RETURNS_SYM                   /* SQL-2003-R */
445
447
%token  RETURN_SYM                    /* SQL-2003-R */
552
554
%token  YEAR_SYM                      /* SQL-2003-R */
553
555
%token  ZEROFILL_SYM
554
556
 
555
 
/* Lowest to highest */
556
557
%left   JOIN_SYM INNER_SYM STRAIGHT_JOIN CROSS LEFT RIGHT
557
558
/* A dummy token to force the priority of table_ref production in a join. */
558
 
%left  TABLE_REF_PRIORITY
559
 
%left  SET_VAR
560
 
%left  OR_SYM
561
 
%left  XOR
562
 
%left  AND_SYM
563
 
%right NOT_SYM
564
 
%right '='
565
 
%nonassoc EQUAL_SYM GE '>' LE '<' NE
566
 
%nonassoc LIKE REGEXP_SYM
567
 
%nonassoc BETWEEN_SYM
568
 
%nonassoc IN_SYM
569
 
%nonassoc IS NULL_SYM TRUE_SYM FALSE_SYM
 
559
%left   TABLE_REF_PRIORITY
 
560
%left   SET_VAR
 
561
%left   OR_SYM
 
562
%left   XOR
 
563
%left   AND_SYM
 
564
%left   BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE
 
565
%left   EQ EQUAL_SYM GE GT_SYM LE LT NE IS LIKE REGEXP_SYM IN_SYM
570
566
%left   '-' '+'
571
567
%left   '*' '/' '%' DIV_SYM MOD_SYM
 
568
%left   NEG
 
569
%right  NOT_SYM
572
570
%right  BINARY COLLATE_SYM
573
571
%left  INTERVAL_SYM
574
 
%right UMINUS
575
 
%left  '(' ')'
576
 
%left  '{' '}'
577
572
 
578
573
%type <lex_str>
579
574
        IDENT IDENT_QUOTED TEXT_STRING DECIMAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM
728
723
        opt_precision opt_ignore opt_column
729
724
        set unlock string_list
730
725
        ref_list opt_match_clause opt_on_update_delete use
731
 
        opt_delete_option varchar
 
726
        opt_delete_options opt_delete_option varchar
732
727
        opt_outer table_list table_name
733
728
        opt_option opt_place
734
729
        opt_attribute opt_attribute_list attribute
736
731
        equal optional_braces
737
732
        normal_join
738
733
        table_to_table_list table_to_table opt_table_list
 
734
        single_multi
739
735
        union_clause union_list
740
736
        precision subselect_start
741
737
        subselect_end select_var_list select_var_list_init opt_len
750
746
%type <num> index_hint_clause
751
747
%type <filetype> data_file
752
748
 
 
749
%type <NONE>
 
750
        '-' '+' '*' '/' '%' '(' ')'
 
751
        ',' '!' '{' '}' AND_SYM OR_SYM BETWEEN_SYM CASE_SYM
 
752
        THEN_SYM WHEN_SYM DIV_SYM MOD_SYM DELETE_SYM
753
753
%%
754
754
 
755
755
/*
776
776
query:
777
777
          END_OF_INPUT
778
778
          {
779
 
            if (!(YYSession->getLex()->select_lex.options & OPTION_FOUND_COMMENT))
 
779
            Session *session= YYSession;
 
780
            if (!(session->lex->select_lex.options & OPTION_FOUND_COMMENT))
780
781
            {
781
782
              my_message(ER_EMPTY_QUERY, ER(ER_EMPTY_QUERY), MYF(0));
782
783
              DRIZZLE_YYABORT;
783
784
            }
784
785
            else
785
786
            {
786
 
              YYSession->getLex()->statement= new statement::EmptyQuery(YYSession);
 
787
              session->lex->statement= new statement::EmptyQuery(YYSession);
787
788
            }
788
789
          }
789
790
        | verb_clause END_OF_INPUT {}
839
840
                                                     TL_OPTION_UPDATING,
840
841
                                                     TL_WRITE))
841
842
              DRIZZLE_YYABORT;
842
 
            Lex->col_list.clear();
 
843
            Lex->col_list.empty();
843
844
          }
844
845
          create_table_definition
845
846
          {
970
971
            statement::CreateSchema *statement= (statement::CreateSchema *)Lex->statement;
971
972
            statement->schema_message.mutable_engine()->add_options()->set_name($1.str);
972
973
          }
973
 
        | REPLICATION opt_equal TRUE_SYM
974
 
          {
975
 
            parser::buildReplicationOption(Lex, true);
976
 
          }
977
 
        | REPLICATION opt_equal FALSE_SYM
978
 
          {
979
 
            parser::buildReplicationOption(Lex, false);
980
 
          }
981
974
        | ident_or_text equal ident_or_text
982
975
          {
983
976
            parser::buildSchemaOption(Lex, $1.str, $3);
1029
1022
          {
1030
1023
            Lex->table()->mutable_options()->set_auto_increment_value($3);
1031
1024
          }
1032
 
        | REPLICATION opt_equal TRUE_SYM
1033
 
          {
1034
 
            Lex->table()->mutable_options()->set_dont_replicate(false);
1035
 
          }
1036
 
        | REPLICATION opt_equal FALSE_SYM
1037
 
          {
1038
 
            Lex->table()->mutable_options()->set_dont_replicate(true);
1039
 
          }
1040
1025
        |  ROW_FORMAT_SYM equal row_format_or_text
1041
1026
          {
1042
1027
            parser::buildEngineOption(Lex, "ROW_FORMAT", $3);
1109
1094
          field_spec opt_check_constraint
1110
1095
        | field_spec references
1111
1096
          {
1112
 
            Lex->col_list.clear(); /* Alloced by memory::sql_alloc */
 
1097
            Lex->col_list.empty(); /* Alloced by memory::sql_alloc */
1113
1098
          }
1114
1099
        ;
1115
1100
 
1129
1114
          }
1130
1115
        | constraint opt_check_constraint
1131
1116
          {
1132
 
            Lex->col_list.clear(); /* Alloced by memory::sql_alloc */
 
1117
            Lex->col_list.empty(); /* Alloced by memory::sql_alloc */
1133
1118
          }
1134
1119
        | opt_constraint check_constraint
1135
1120
          {
1136
 
            Lex->col_list.clear(); /* Alloced by memory::sql_alloc */
 
1121
            Lex->col_list.empty(); /* Alloced by memory::sql_alloc */
1137
1122
          }
1138
1123
        ;
1139
1124
 
1266
1251
          }
1267
1252
        | ENUM_SYM
1268
1253
          {
1269
 
            Lex->interval_list.clear();
 
1254
            Lex->interval_list.empty();
1270
1255
          }
1271
1256
          '(' string_list ')'
1272
1257
          {
1487
1472
        ;
1488
1473
 
1489
1474
references:
1490
 
          REFERENCES table_ident opt_ref_list opt_match_clause opt_on_update_delete
 
1475
          REFERENCES
 
1476
          table_ident
 
1477
          opt_ref_list
 
1478
          opt_match_clause
 
1479
          opt_on_update_delete
1491
1480
          {
1492
1481
            $$=$2;
1493
1482
          }
1495
1484
 
1496
1485
opt_ref_list:
1497
1486
          /* empty */
1498
 
          { Lex->ref_list.clear(); }
 
1487
          { Lex->ref_list.empty(); }
1499
1488
        | '(' ref_list ')'
1500
1489
        ;
1501
1490
 
1504
1493
          { Lex->ref_list.push_back(new Key_part_spec($3, 0)); }
1505
1494
        | ident
1506
1495
          {
1507
 
            Lex->ref_list.clear();
 
1496
            Lex->ref_list.empty();
1508
1497
            Lex->ref_list.push_back(new Key_part_spec($1, 0));
1509
1498
          }
1510
1499
        ;
1679
1668
              DRIZZLE_YYABORT;
1680
1669
            }
1681
1670
 
1682
 
            Lex->col_list.clear();
 
1671
            Lex->col_list.empty();
1683
1672
            Lex->select_lex.init_order();
1684
1673
            Lex->select_lex.db= const_cast<char *>(((TableList*) Lex->select_lex.table_list.first)->getSchemaName());
1685
1674
          }
1801
1790
          }
1802
1791
        | DROP FOREIGN KEY_SYM opt_ident
1803
1792
          {
1804
 
            parser::buildAddAlterDropIndex(Lex, $4.str, true);
 
1793
            statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
 
1794
            statement->alter_info.drop_list.push_back(new AlterDrop(AlterDrop::FOREIGN_KEY,
 
1795
                                                                    $4.str));
 
1796
            statement->alter_info.flags.set(ALTER_DROP_INDEX);
 
1797
            statement->alter_info.flags.set(ALTER_FOREIGN_KEY);
1805
1798
          }
1806
1799
        | DROP PRIMARY_SYM KEY_SYM
1807
1800
          {
1808
 
            parser::buildAddAlterDropIndex(Lex, "PRIMARY");
 
1801
            statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
 
1802
 
 
1803
            statement->alter_info.drop_list.push_back(new AlterDrop(AlterDrop::KEY,
 
1804
                                                               "PRIMARY"));
 
1805
            statement->alter_info.flags.set(ALTER_DROP_INDEX);
1809
1806
          }
1810
1807
        | DROP key_or_index field_ident
1811
1808
          {
1812
 
            parser::buildAddAlterDropIndex(Lex, $3.str);
 
1809
            statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
 
1810
 
 
1811
            statement->alter_info.drop_list.push_back(new AlterDrop(AlterDrop::KEY,
 
1812
                                                                    $3.str));
 
1813
            statement->alter_info.flags.set(ALTER_DROP_INDEX);
1813
1814
          }
1814
1815
        | DISABLE_SYM KEYS
1815
1816
          {
1915
1916
opt_to:
1916
1917
          /* empty */ {}
1917
1918
        | TO_SYM {}
 
1919
        | EQ {}
1918
1920
        | AS {}
1919
1921
        ;
1920
1922
 
2161
2163
        | select_item
2162
2164
        | '*'
2163
2165
          {
2164
 
            if (YYSession->add_item_to_list( new Item_field(&YYSession->getLex()->current_select->context, NULL, NULL, "*")))
 
2166
            if (YYSession->add_item_to_list( new Item_field(&YYSession->lex->current_select->
 
2167
                                                          context,
 
2168
                                                          NULL, NULL, "*")))
2165
2169
              DRIZZLE_YYABORT;
2166
 
 
2167
 
            (YYSession->getLex()->current_select->with_wild)++;
 
2170
            (YYSession->lex->current_select->with_wild)++;
2168
2171
          }
2169
2172
        ;
2170
2173
 
2341
2344
          { $$= new Item_func_isnotnull($1); }
2342
2345
        | bool_pri EQUAL_SYM predicate %prec EQUAL_SYM
2343
2346
          { $$= new Item_func_equal($1,$3); }
2344
 
        | bool_pri comp_op predicate %prec '='
 
2347
        | bool_pri comp_op predicate %prec EQ
2345
2348
          { $$= (*$2)(0)->create($1,$3); }
2346
 
        | bool_pri comp_op all_or_any '(' subselect ')' %prec '='
 
2349
        | bool_pri comp_op all_or_any '(' subselect ')' %prec EQ
2347
2350
          { $$= all_any_subquery_creator($1, $2, $3, $5); }
2348
2351
        | predicate
2349
2352
        ;
2457
2460
        ;
2458
2461
 
2459
2462
comp_op:
2460
 
          '='     { $$ = &comp_eq_creator; }
 
2463
          EQ     { $$ = &comp_eq_creator; }
2461
2464
        | GE     { $$ = &comp_ge_creator; }
2462
 
        | '>' { $$ = &comp_gt_creator; }
 
2465
        | GT_SYM { $$ = &comp_gt_creator; }
2463
2466
        | LE     { $$ = &comp_le_creator; }
2464
 
        | '<'     { $$ = &comp_lt_creator; }
 
2467
        | LT     { $$ = &comp_lt_creator; }
2465
2468
        | NE     { $$ = &comp_ne_creator; }
2466
2469
        ;
2467
2470
 
2476
2479
        | function_call_nonkeyword
2477
2480
        | function_call_generic
2478
2481
        | function_call_conflict
2479
 
        | simple_expr COLLATE_SYM ident_or_text %prec UMINUS
 
2482
        | simple_expr COLLATE_SYM ident_or_text %prec NEG
2480
2483
          {
2481
2484
            Item *i1= new (YYSession->mem_root) Item_string($3.str,
2482
2485
                                                      $3.length,
2489
2492
          {
2490
2493
            Lex->setSumExprUsed();
2491
2494
          }
2492
 
        | '+' simple_expr %prec UMINUS { $$= $2; }
2493
 
        | '-' simple_expr %prec UMINUS
 
2495
        | '+' simple_expr %prec NEG { $$= $2; }
 
2496
        | '-' simple_expr %prec NEG
2494
2497
          { $$= new (YYSession->mem_root) Item_func_neg($2); }
2495
2498
        | '(' subselect ')'
2496
2499
          {
2512
2515
            $$= new (YYSession->mem_root) Item_exists_subselect($3);
2513
2516
          }
2514
2517
        | '{' ident expr '}' { $$= $3; }
2515
 
        | BINARY simple_expr %prec UMINUS
 
2518
        | BINARY simple_expr %prec NEG
2516
2519
          {
2517
2520
            $$= create_func_cast(YYSession, $2, ITEM_CAST_CHAR, NULL, NULL,
2518
2521
                                 &my_charset_bin);
2559
2562
          { $$= new (YYSession->mem_root) Item_func_char(*$3); }
2560
2563
        | CURRENT_USER optional_braces
2561
2564
          {
2562
 
            if (! ($$= parser::reserved_keyword_function(YYSession, "user", NULL)))
 
2565
            std::string user_str("user");
 
2566
            if (! ($$= parser::reserved_keyword_function(YYSession, user_str, NULL)))
2563
2567
            {
2564
2568
              DRIZZLE_YYABORT;
2565
2569
            }
2679
2683
          { $$= new (YYSession->mem_root) Item_date_add_interval($3, $6, $7, 1); }
2680
2684
        | SUBSTRING '(' expr ',' expr ',' expr ')'
2681
2685
          {
 
2686
            std::string reverse_str("substr");
2682
2687
            List<Item> *args= new (YYSession->mem_root) List<Item>;
2683
2688
            args->push_back($3);
2684
2689
            args->push_back($5);
2685
2690
            args->push_back($7);
2686
 
            if (! ($$= parser::reserved_keyword_function(YYSession, "substr", args)))
 
2691
            if (! ($$= parser::reserved_keyword_function(YYSession, reverse_str, args)))
2687
2692
            {
2688
2693
              DRIZZLE_YYABORT;
2689
2694
            }
2690
2695
          }
2691
2696
        | SUBSTRING '(' expr ',' expr ')'
2692
2697
          {
 
2698
            std::string reverse_str("substr");
2693
2699
            List<Item> *args= new (YYSession->mem_root) List<Item>;
2694
2700
            args->push_back($3);
2695
2701
            args->push_back($5);
2696
 
            if (! ($$= parser::reserved_keyword_function(YYSession, "substr", args)))
 
2702
            if (! ($$= parser::reserved_keyword_function(YYSession, reverse_str, args)))
2697
2703
            {
2698
2704
              DRIZZLE_YYABORT;
2699
2705
            }
2700
2706
          }
2701
2707
        | SUBSTRING '(' expr FROM expr FOR_SYM expr ')'
2702
2708
          {
 
2709
            std::string reverse_str("substr");
2703
2710
            List<Item> *args= new (YYSession->mem_root) List<Item>;
2704
2711
            args->push_back($3);
2705
2712
            args->push_back($5);
2706
2713
            args->push_back($7);
2707
 
            if (! ($$= parser::reserved_keyword_function(YYSession, "substr", args)))
 
2714
            if (! ($$= parser::reserved_keyword_function(YYSession, reverse_str, args)))
2708
2715
            {
2709
2716
              DRIZZLE_YYABORT;
2710
2717
            }
2711
2718
          }
2712
2719
        | SUBSTRING '(' expr FROM expr ')'
2713
2720
          {
 
2721
            std::string reverse_str("substr");
2714
2722
            List<Item> *args= new (YYSession->mem_root) List<Item>;
2715
2723
            args->push_back($3);
2716
2724
            args->push_back($5);
2717
 
            if (! ($$= parser::reserved_keyword_function(YYSession, "substr", args)))
 
2725
            if (! ($$= parser::reserved_keyword_function(YYSession, reverse_str, args)))
2718
2726
            {
2719
2727
              DRIZZLE_YYABORT;
2720
2728
            }
2790
2798
          { $$= new (YYSession->mem_root) Item_func_if($3,$5,$7); }
2791
2799
        | KILL_SYM kill_option '(' expr ')'
2792
2800
          {
 
2801
            std::string kill_str("kill");
2793
2802
            List<Item> *args= new (YYSession->mem_root) List<Item>;
2794
2803
            args->push_back($4);
2795
2804
 
2798
2807
              args->push_back(new (YYSession->mem_root) Item_uint(1));
2799
2808
            }
2800
2809
 
2801
 
            if (! ($$= parser::reserved_keyword_function(YYSession, "kill", args)))
 
2810
            if (! ($$= parser::reserved_keyword_function(YYSession, kill_str, args)))
2802
2811
            {
2803
2812
              DRIZZLE_YYABORT;
2804
2813
            }
2817
2826
          { $$= new (YYSession->mem_root) Item_func_round($3,$5,1); }
2818
2827
        | WAIT_SYM '(' expr ')'
2819
2828
          {
 
2829
            std::string wait_str("wait");
2820
2830
            List<Item> *args= new (YYSession->mem_root) List<Item>;
2821
2831
            args->push_back($3);
2822
 
            if (! ($$= parser::reserved_keyword_function(YYSession, "wait", args)))
 
2832
            if (! ($$= parser::reserved_keyword_function(YYSession, wait_str, args)))
2823
2833
            {
2824
2834
              DRIZZLE_YYABORT;
2825
2835
            }
2834
2844
          }
2835
2845
        | WAIT_SYM '(' expr ',' expr ')'
2836
2846
          {
 
2847
            std::string wait_str("wait");
2837
2848
            List<Item> *args= new (YYSession->mem_root) List<Item>;
2838
2849
            args->push_back($3);
2839
2850
            args->push_back($5);
2840
 
            if (! ($$= parser::reserved_keyword_function(YYSession, "wait", args)))
 
2851
            if (! ($$= parser::reserved_keyword_function(YYSession, wait_str, args)))
2841
2852
            {
2842
2853
              DRIZZLE_YYABORT;
2843
2854
            }
2988
2999
            sel->in_sum_expr--;
2989
3000
            $$=new Item_func_group_concat(Lex->current_context(), $3, $5,
2990
3001
                                          sel->gorder_list, $7);
2991
 
            $5->clear();
 
3002
            $5->empty();
2992
3003
          }
2993
3004
        ;
2994
3005
 
3049
3060
            select->gorder_list=
3050
3061
              (SQL_LIST*) memory::sql_memdup((char*) &select->order_list,
3051
3062
                                     sizeof(st_sql_list));
3052
 
            select->order_list.clear();
 
3063
            select->order_list.empty();
3053
3064
          }
3054
3065
        ;
3055
3066
 
3673
3684
table_alias:
3674
3685
          /* empty */
3675
3686
        | AS
 
3687
        | EQ
3676
3688
        ;
3677
3689
 
3678
3690
opt_table_alias:
4111
4123
insert_table:
4112
4124
          table_name
4113
4125
          {
4114
 
            Lex->field_list.clear();
4115
 
            Lex->many_values.clear();
 
4126
            Lex->field_list.empty();
 
4127
            Lex->many_values.empty();
4116
4128
            Lex->insert_list=0;
4117
4129
          };
4118
4130
 
4169
4181
        ;
4170
4182
 
4171
4183
equal:
4172
 
          '=' {}
 
4184
          EQ {}
4173
4185
        | SET_VAR {}
4174
4186
        ;
4175
4187
 
4223
4235
/* Update rows in a table */
4224
4236
 
4225
4237
update:
4226
 
          UPDATE_SYM opt_ignore table_ident SET_SYM update_list
 
4238
          UPDATE_SYM opt_ignore table_ident
4227
4239
          {
4228
4240
            init_select(Lex);
4229
4241
            Lex->statement= new statement::Update(YYSession);
4231
4243
            Lex->duplicates= DUP_ERROR;
4232
4244
            if (not Lex->select_lex.add_table_to_list(YYSession, $3, NULL,0))
4233
4245
              DRIZZLE_YYABORT;
4234
 
 
 
4246
          }
 
4247
          SET_SYM update_list
 
4248
          {
4235
4249
            if (Lex->select_lex.get_table_list()->derived)
4236
4250
            {
4237
4251
              /* it is single table update and it is update of derived table */
4279
4293
/* Delete rows from a table */
4280
4294
 
4281
4295
delete:
4282
 
          DELETE_SYM opt_delete_option FROM table_ident
 
4296
          DELETE_SYM
4283
4297
          {
4284
4298
            Lex->statement= new statement::Delete(YYSession);
4285
4299
            init_select(Lex);
4286
4300
            Lex->lock_option= TL_WRITE_DEFAULT;
 
4301
            Lex->ignore= 0;
4287
4302
            Lex->select_lex.init_order();
 
4303
          }
 
4304
          opt_delete_options single_multi
 
4305
        ;
4288
4306
 
4289
 
            if (!Lex->current_select->add_table_to_list(YYSession, $4, NULL, TL_OPTION_UPDATING,
 
4307
single_multi:
 
4308
          FROM table_ident
 
4309
          {
 
4310
            if (!Lex->current_select->add_table_to_list(YYSession, $2, NULL, TL_OPTION_UPDATING,
4290
4311
                                           Lex->lock_option))
4291
4312
              DRIZZLE_YYABORT;
4292
4313
          }
4294
4315
          delete_limit_clause {}
4295
4316
        ;
4296
4317
 
 
4318
opt_delete_options:
 
4319
          /* empty */ {}
 
4320
        | opt_delete_option opt_delete_options {}
 
4321
        ;
 
4322
 
4297
4323
opt_delete_option:
4298
 
           /* empty */ { Lex->ignore= 0; }
4299
 
         | IGNORE_SYM  { Lex->ignore= 1; }
 
4324
         IGNORE_SYM   { Lex->ignore= 1; }
4300
4325
        ;
4301
4326
 
4302
4327
truncate:
4582
4607
                    $12, NULL, TL_OPTION_UPDATING,
4583
4608
                    Lex->lock_option))
4584
4609
              DRIZZLE_YYABORT;
4585
 
            Lex->field_list.clear();
4586
 
            Lex->update_list.clear();
4587
 
            Lex->value_list.clear();
 
4610
            Lex->field_list.empty();
 
4611
            Lex->update_list.empty();
 
4612
            Lex->value_list.empty();
4588
4613
          }
4589
4614
          opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec
4590
4615
          opt_load_data_set_spec
5402
5427
          }
5403
5428
          order_or_limit
5404
5429
          {
5405
 
            YYSession->getLex()->current_select->no_table_names_allowed= 0;
 
5430
            YYSession->lex->current_select->no_table_names_allowed= 0;
5406
5431
            YYSession->setWhere("");
5407
5432
          }
5408
5433
        ;