~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Brian Aker
  • Date: 2009-12-03 21:03:24 UTC
  • mto: (1237.2.7 push) (1238.1.1 push)
  • mto: This revision was merged to the branch mainline in revision 1238.
  • Revision ID: brian@gaz-20091203210324-y5e4a6qw37jajekc
Remove dead bits in parser/whitespace/etc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
205
205
  The parser will abort immediately after invoking this callback.
206
206
 
207
207
  This function is not for use in semantic actions and is internal to
208
 
  the parser, as it performs some pre-return cleanup. 
 
208
  the parser, as it performs some pre-return cleanup.
209
209
  In semantic actions, please use my_parse_error or my_error to
210
210
  push an error into the error stack and DRIZZLE_YYABORT
211
211
  to abort from the parser.
349
349
   @return false if successful, true if an error was reported. In the latter
350
350
   case parsing should stop.
351
351
 */
352
 
static bool setup_select_in_parentheses(LEX *lex) 
 
352
static bool setup_select_in_parentheses(LEX *lex)
353
353
{
354
354
  Select_Lex * sel= lex->current_select;
355
355
  if (sel->set_braces(1))
472
472
%token  BETWEEN_SYM                   /* SQL-2003-R */
473
473
%token  BIGINT_SYM                    /* SQL-2003-R */
474
474
%token  BINARY                        /* SQL-2003-R */
475
 
%token  BINLOG_SYM
476
475
%token  BIN_NUM
477
476
%token  BIT_SYM                       /* MYSQL-FUNC */
478
477
%token  BLOB_SYM                      /* SQL-2003-R */
484
483
%token  BTREE_SYM
485
484
%token  BY                            /* SQL-2003-R */
486
485
%token  BYTE_SYM
487
 
%token  CACHE_SYM
488
486
%token  CALL_SYM                      /* SQL-2003-R */
489
487
%token  CASCADE                       /* SQL-2003-N */
490
488
%token  CASCADED                      /* SQL-2003-R */
492
490
%token  CAST_SYM                      /* SQL-2003-R */
493
491
%token  CHAIN_SYM                     /* SQL-2003-N */
494
492
%token  CHANGE
495
 
%token  CHANGED
496
 
%token  CHARSET
497
493
%token  CHAR_SYM                      /* SQL-2003-R */
498
494
%token  CHECKSUM_SYM
499
495
%token  CHECK_SYM                     /* SQL-2003-R */
507
503
%token  COMMITTED_SYM                 /* SQL-2003-N */
508
504
%token  COMMIT_SYM                    /* SQL-2003-R */
509
505
%token  COMPACT_SYM
510
 
%token  COMPLETION_SYM
511
506
%token  COMPRESSED_SYM
512
507
%token  CONCURRENT
513
508
%token  CONDITION_SYM                 /* SQL-2003-N */
515
510
%token  CONSISTENT_SYM
516
511
%token  CONSTRAINT                    /* SQL-2003-R */
517
512
%token  CONTAINS_SYM                  /* SQL-2003-N */
518
 
%token  CONTEXT_SYM
519
513
%token  CONTINUE_SYM                  /* SQL-2003-R */
520
514
%token  CONVERT_SYM                   /* SQL-2003-N */
521
515
%token  COUNT_SYM                     /* SQL-2003-N */
573
567
%token  ESCAPE_SYM                    /* SQL-2003-R */
574
568
%token  EXCLUSIVE_SYM
575
569
%token  EXISTS                        /* SQL-2003-R */
576
 
%token  EXIT_SYM
577
570
%token  EXTENDED_SYM
578
 
%token  EXTENT_SIZE_SYM
579
571
%token  EXTRACT_SYM                   /* SQL-2003-N */
580
572
%token  FALSE_SYM                     /* SQL-2003-R */
581
 
%token  FAST_SYM
582
573
%token  FETCH_SYM                     /* SQL-2003-R */
583
574
%token  COLUMN_FORMAT_SYM
584
575
%token  FILE_SYM
601
592
%token  HASH_SYM
602
593
%token  HAVING                        /* SQL-2003-R */
603
594
%token  HEX_NUM
604
 
%token  HOST_SYM
605
 
%token  HOSTS_SYM
606
595
%token  HOUR_MICROSECOND_SYM
607
596
%token  HOUR_MINUTE_SYM
608
597
%token  HOUR_SECOND_SYM
620
609
%token  INOUT_SYM                     /* SQL-2003-R */
621
610
%token  INSENSITIVE_SYM               /* SQL-2003-R */
622
611
%token  INSERT                        /* SQL-2003-R */
623
 
%token  INSERT_METHOD
624
 
%token  INSTALL_SYM
625
612
%token  INTERVAL_SYM                  /* SQL-2003-R */
626
613
%token  INTO                          /* SQL-2003-R */
627
614
%token  INT_SYM                       /* SQL-2003-R */
662
649
%token  MEDIUM_SYM
663
650
%token  MERGE_SYM                     /* SQL-2003-R */
664
651
%token  MICROSECOND_SYM               /* MYSQL-FUNC */
665
 
%token  MIGRATE_SYM
666
652
%token  MINUTE_MICROSECOND_SYM
667
653
%token  MINUTE_SECOND_SYM
668
654
%token  MINUTE_SYM                    /* SQL-2003-R */
681
667
%token  NEG
682
668
%token  NEW_SYM                       /* SQL-2003-R */
683
669
%token  NEXT_SYM                      /* SQL-2003-N */
684
 
%token  NODEGROUP_SYM
685
670
%token  NONE_SYM                      /* SQL-2003-R */
686
671
%token  NOT_SYM                       /* SQL-2003-R */
687
672
%token  NOW_SYM
688
 
%token  NOWAIT_SYM
689
673
%token  NO_SYM                        /* SQL-2003-R */
690
 
%token  NO_WAIT_SYM
691
 
%token  NO_WRITE_TO_BINLOG
692
674
%token  NULL_SYM                      /* SQL-2003-R */
693
675
%token  NUM
694
676
%token  NUMERIC_SYM                   /* SQL-2003-R */
699
681
%token  ONE_SYM
700
682
%token  ONLINE_SYM
701
683
%token  OPEN_SYM                      /* SQL-2003-R */
702
 
%token  OPTIMIZE
703
 
%token  OPTIONS_SYM
 
684
%token  OPTIMIZE                      /* Leave assuming we might add it back */
704
685
%token  OPTION                        /* SQL-2003-N */
705
686
%token  OPTIONALLY
706
687
%token  ORDER_SYM                     /* SQL-2003-R */
709
690
%token  OUTFILE
710
691
%token  OUT_SYM                       /* SQL-2003-R */
711
692
%token  PAGE_SYM
712
 
%token  PARAM_MARKER
713
693
%token  PARTIAL                       /* SQL-2003-N */
714
694
%token  PHASE_SYM
715
 
%token  POINT_SYM
716
 
%token  PORT_SYM
717
695
%token  POSITION_SYM                  /* SQL-2003-N */
718
696
%token  PRECISION                     /* SQL-2003-R */
719
697
%token  PREV_SYM
720
698
%token  PRIMARY_SYM                   /* SQL-2003-R */
721
699
%token  PROCESS
722
700
%token  PROCESSLIST_SYM
723
 
%token  PURGE
724
701
%token  QUARTER_SYM
725
702
%token  QUERY_SYM
726
 
%token  QUICK
727
703
%token  RANGE_SYM                     /* SQL-2003-R */
728
704
%token  READS_SYM                     /* SQL-2003-R */
729
705
%token  READ_ONLY_SYM
730
706
%token  READ_SYM                      /* SQL-2003-N */
731
707
%token  READ_WRITE_SYM
732
708
%token  REAL                          /* SQL-2003-R */
733
 
%token  REBUILD_SYM
734
 
%token  RECOVER_SYM
735
 
%token  REDOFILE_SYM
736
 
%token  REDO_BUFFER_SIZE_SYM
737
709
%token  REDUNDANT_SYM
738
710
%token  REFERENCES                    /* SQL-2003-R */
739
711
%token  RELEASE_SYM                   /* SQL-2003-R */
740
 
%token  RELOAD
741
 
%token  REMOVE_SYM
742
712
%token  RENAME
743
 
%token  REORGANIZE_SYM
744
713
%token  REPEATABLE_SYM                /* SQL-2003-N */
745
714
%token  REPEAT_SYM                    /* MYSQL-FUNC */
746
715
%token  REPLACE                       /* MYSQL-FUNC */
747
 
%token  REPLICATION
748
 
%token  REQUIRE_SYM
749
 
%token  RESET_SYM
750
 
%token  RESOURCES
751
716
%token  RESTRICT
752
 
%token  RESUME_SYM
753
717
%token  RETURNS_SYM                   /* SQL-2003-R */
754
718
%token  RETURN_SYM                    /* SQL-2003-R */
755
719
%token  REVERSE_SYM
780
744
%token  SHUTDOWN
781
745
%token  SIMPLE_SYM                    /* SQL-2003-N */
782
746
%token  SNAPSHOT_SYM
783
 
%token  SOCKET_SYM
784
 
%token  SONAME_SYM
785
 
%token  SOURCE_SYM
786
747
%token  SPECIFIC_SYM                  /* SQL-2003-R */
787
748
%token  SQLEXCEPTION_SYM              /* SQL-2003-R */
788
749
%token  SQLSTATE_SYM                  /* SQL-2003-R */
793
754
%token  SQL_SMALL_RESULT
794
755
%token  SQL_SYM                       /* SQL-2003-R */
795
756
%token  STARTING
796
 
%token  STARTS_SYM
797
757
%token  START_SYM                     /* SQL-2003-R */
798
758
%token  STATUS_SYM
799
759
%token  STDDEV_SAMP_SYM               /* SQL-2003-N */
816
776
%token  TABLE_REF_PRIORITY
817
777
%token  TABLE_SYM                     /* SQL-2003-R */
818
778
%token  TEMPORARY_SYM                 /* SQL-2003-N */
819
 
%token  TEMPTABLE_SYM
820
779
%token  TERMINATED
821
780
%token  TEXT_STRING
822
781
%token  TEXT_SYM
823
 
%token  THAN_SYM
824
782
%token  THEN_SYM                      /* SQL-2003-R */
825
783
%token  TIMESTAMP_SYM                 /* SQL-2003-R */
826
784
%token  TIMESTAMP_ADD
835
793
%token  TYPE_SYM                      /* SQL-2003-N */
836
794
%token  ULONGLONG_NUM
837
795
%token  UNCOMMITTED_SYM               /* SQL-2003-N */
838
 
%token  UNDEFINED_SYM
839
796
%token  UNDOFILE_SYM
840
797
%token  UNDO_SYM                      /* FUTURE-USE */
841
798
%token  UNION_SYM                     /* SQL-2003-R */
842
799
%token  UNIQUE_SYM
843
800
%token  UNKNOWN_SYM                   /* SQL-2003-R */
844
801
%token  UNLOCK_SYM
845
 
%token  UNTIL_SYM
846
802
%token  UPDATE_SYM                    /* SQL-2003-R */
847
803
%token  USAGE                         /* SQL-2003-N */
848
804
%token  USER                          /* SQL-2003-R */
858
814
%token  VARIANCE_SYM
859
815
%token  VARYING                       /* SQL-2003-R */
860
816
%token  VAR_SAMP_SYM
861
 
%token  WAIT_SYM
862
817
%token  WARNINGS
863
818
%token  WEEK_SYM
864
819
%token  WEIGHT_STRING_SYM
925
880
        ws_nweights
926
881
        ws_level_flag_desc ws_level_flag_reverse ws_level_flags
927
882
        opt_ws_levels ws_level_list ws_level_list_item ws_level_number
928
 
        ws_level_range ws_level_list_or_range  
 
883
        ws_level_range ws_level_list_or_range 
929
884
 
930
885
%type <ulonglong_number>
931
886
        ulonglong_num
998
953
%type <variable> internal_variable_name
999
954
 
1000
955
%type <select_lex> subselect
1001
 
        get_select_lex query_specification 
 
956
        get_select_lex query_specification
1002
957
        query_expression_body
1003
958
 
1004
959
%type <boolfunc2creator> comp_op
1146
1101
            lex->name.str= 0;
1147
1102
 
1148
1103
            message::Table *proto= &statement->create_table_proto;
1149
 
            
 
1104
           
1150
1105
            proto->set_name($5->table.str);
1151
1106
            if($2)
1152
1107
              proto->set_type(message::Table::TEMPORARY);
1156
1111
          create2
1157
1112
          {
1158
1113
            LEX *lex= YYSession->lex;
1159
 
            lex->current_select= &lex->select_lex; 
 
1114
            lex->current_select= &lex->select_lex;
1160
1115
          }
1161
1116
        | CREATE build_method
1162
1117
          {
1255
1210
            {
1256
1211
              lex->sql_command= SQLCOM_INSERT_SELECT;
1257
1212
              delete lex->statement;
1258
 
              lex->statement= 
 
1213
              lex->statement=
1259
1214
                new(std::nothrow) statement::InsertSelect(YYSession);
1260
1215
              if (lex->statement == NULL)
1261
1216
                DRIZZLE_YYABORT;
1264
1219
            {
1265
1220
              lex->sql_command= SQLCOM_REPLACE_SELECT;
1266
1221
              delete lex->statement;
1267
 
              lex->statement= 
 
1222
              lex->statement=
1268
1223
                new(std::nothrow) statement::ReplaceSelect(YYSession);
1269
1224
              if (lex->statement == NULL)
1270
1225
                DRIZZLE_YYABORT;
1338
1293
 
1339
1294
            protoengine->set_name($3.str);
1340
1295
          }
1341
 
        | BLOCK_SIZE_SYM opt_equal ulong_num    
1342
 
          { 
 
1296
        | BLOCK_SIZE_SYM opt_equal ulong_num
 
1297
          {
1343
1298
            message::Table::TableOptions *tableopts;
1344
1299
            statement::CreateTable *statement= (statement::CreateTable *)Lex->statement;
1345
1300
            tableopts= ((statement::CreateTable *)Lex->statement)->create_table_proto.mutable_options();
1547
1502
            if (add_field_to_list(lex->session, &$1, (enum enum_field_types) $3,
1548
1503
                                  lex->length,lex->dec,lex->type,
1549
1504
                                  statement->column_format,
1550
 
                                  statement->default_value, statement->on_update_value, 
 
1505
                                  statement->default_value, statement->on_update_value,
1551
1506
                                  &statement->comment,
1552
1507
                                  statement->change, &lex->interval_list, lex->charset))
1553
1508
              DRIZZLE_YYABORT;
1866
1821
              constraints->set_is_nullable(false);
1867
1822
            }
1868
1823
          }
1869
 
        | DEFAULT now_or_signed_literal 
1870
 
          { 
 
1824
        | DEFAULT now_or_signed_literal
 
1825
          {
1871
1826
            statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1872
1827
 
1873
 
            statement->default_value=$2; 
 
1828
            statement->default_value=$2;
1874
1829
            statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT);
1875
1830
          }
1876
 
        | ON UPDATE_SYM NOW_SYM optional_braces 
 
1831
        | ON UPDATE_SYM NOW_SYM optional_braces
1877
1832
          { ((statement::AlterTable *)Lex->statement)->on_update_value= new Item_func_now_local(); }
1878
1833
        | AUTO_INC
1879
1834
          {
1889
1844
            }
1890
1845
          }
1891
1846
        | SERIAL_SYM DEFAULT VALUE_SYM
1892
 
          { 
 
1847
          {
1893
1848
            LEX *lex=Lex;
1894
1849
            statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1895
1850
 
1923
1878
            LEX *lex=Lex;
1924
1879
            statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1925
1880
 
1926
 
            lex->type|= UNIQUE_FLAG; 
 
1881
            lex->type|= UNIQUE_FLAG;
1927
1882
            statement->alter_info.flags.set(ALTER_ADD_INDEX);
1928
1883
          }
1929
1884
        | UNIQUE_SYM KEY_SYM
1931
1886
            LEX *lex=Lex;
1932
1887
            statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1933
1888
 
1934
 
            lex->type|= UNIQUE_KEY_FLAG; 
 
1889
            lex->type|= UNIQUE_KEY_FLAG;
1935
1890
            statement->alter_info.flags.set(ALTER_ADD_INDEX);
1936
1891
          }
1937
1892
        | COMMENT_SYM TEXT_STRING_sys
2258
2213
            lex->statement= statement;
2259
2214
            if (lex->statement == NULL)
2260
2215
              DRIZZLE_YYABORT;
2261
 
            lex->duplicates= DUP_ERROR; 
 
2216
            lex->duplicates= DUP_ERROR;
2262
2217
            if (!lex->select_lex.add_table_to_list(session, $5, NULL,
2263
2218
                                                   TL_OPTION_UPDATING))
2264
2219
              DRIZZLE_YYABORT;
2272
2227
          alter_commands
2273
2228
          {}
2274
2229
        | ALTER DATABASE ident_or_empty
2275
 
          { 
 
2230
          {
2276
2231
            LEX *lex=Lex;
2277
2232
            lex->sql_command=SQLCOM_ALTER_DB;
2278
2233
            lex->statement= new(std::nothrow) statement::AlterSchema(YYSession);
2296
2251
 
2297
2252
alter_commands:
2298
2253
          /* empty */
2299
 
        | DISCARD TABLESPACE 
2300
 
          { 
 
2254
        | DISCARD TABLESPACE
 
2255
          {
2301
2256
            statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2302
 
            statement->alter_info.tablespace_op= DISCARD_TABLESPACE; 
 
2257
            statement->alter_info.tablespace_op= DISCARD_TABLESPACE;
2303
2258
          }
2304
 
        | IMPORT TABLESPACE 
2305
 
          { 
 
2259
        | IMPORT TABLESPACE
 
2260
          {
2306
2261
            statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2307
 
            statement->alter_info.tablespace_op= IMPORT_TABLESPACE; 
 
2262
            statement->alter_info.tablespace_op= IMPORT_TABLESPACE;
2308
2263
          }
2309
2264
        | alter_list
2310
2265
        ;
2383
2338
                                  (enum enum_field_types) $5,
2384
2339
                                  lex->length, lex->dec, lex->type,
2385
2340
                                  statement->column_format,
2386
 
                                  statement->default_value, 
 
2341
                                  statement->default_value,
2387
2342
                                  statement->on_update_value,
2388
2343
                                  &statement->comment,
2389
2344
                                  $3.str, &lex->interval_list, lex->charset))
2713
2668
          opt_order_clause opt_limit_clause
2714
2669
          {
2715
2670
            Lex->current_select->context.table_list=
2716
 
              Lex->current_select->context.first_name_resolution_table= 
 
2671
              Lex->current_select->context.first_name_resolution_table=
2717
2672
                reinterpret_cast<TableList *>(Lex->current_select->table_list.first);
2718
2673
          }
2719
2674
        ;
2985
2940
            $$= handle_sql2003_note184_exception(YYSession, $1, true, $4);
2986
2941
          }
2987
2942
        | bit_expr IN_SYM '(' expr ',' expr_list ')'
2988
 
          { 
 
2943
          {
2989
2944
            $6->push_front($4);
2990
2945
            $6->push_front($1);
2991
2946
            $$= new (YYSession->mem_root) Item_func_in(*$6);
3086
3041
        | '-' simple_expr %prec NEG
3087
3042
          { $$= new (YYSession->mem_root) Item_func_neg($2); }
3088
3043
        | '(' subselect ')'
3089
 
          { 
 
3044
          {
3090
3045
            $$= new (YYSession->mem_root) Item_singlerow_subselect($2);
3091
3046
          }
3092
3047
        | '(' expr ')' { $$= $2; }
3731
3686
            DRIZZLE_YYABORT_UNLESS($1 && $5);
3732
3687
          }
3733
3688
          USING '(' using_list ')'
3734
 
          { 
3735
 
            add_join_natural($1,$5,$9,Lex->current_select); 
3736
 
            $5->outer_join|=JOIN_TYPE_LEFT; 
3737
 
            $$=$5; 
 
3689
          {
 
3690
            add_join_natural($1,$5,$9,Lex->current_select);
 
3691
            $5->outer_join|=JOIN_TYPE_LEFT;
 
3692
            $$=$5;
3738
3693
          }
3739
3694
        | table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor
3740
3695
          {
3790
3745
        | CROSS JOIN_SYM {}
3791
3746
        ;
3792
3747
 
3793
 
/* 
 
3748
/*
3794
3749
   This is a flattening of the rules <table factor> and <table primary>
3795
3750
   in the SQL:2003 standard, since we don't have <sample clause>
3796
3751
 
3797
3752
   I.e.
3798
3753
   <table factor> ::= <table primary> [ <sample clause> ]
3799
 
*/   
 
3754
*/  
3800
3755
/* Warning - may return NULL in case of incomplete SELECT */
3801
3756
table_factor:
3802
3757
          {
3838
3793
            Represents a flattening of the following rules from the SQL:2003
3839
3794
            standard. This sub-rule corresponds to the sub-rule
3840
3795
            <table primary> ::= ... | <derived table> [ AS ] <correlation name>
3841
 
            
 
3796
           
3842
3797
            The following rules have been flattened into query_expression_body
3843
3798
            (since we have no <with clause>).
3844
3799
 
4028
3983
index_hint_clause:
4029
3984
          /* empty */
4030
3985
          {
4031
 
            $$= INDEX_HINT_MASK_ALL; 
 
3986
            $$= INDEX_HINT_MASK_ALL;
4032
3987
          }
4033
3988
        | FOR_SYM JOIN_SYM      { $$= INDEX_HINT_MASK_JOIN;  }
4034
3989
        | FOR_SYM ORDER_SYM BY  { $$= INDEX_HINT_MASK_ORDER; }
4037
3992
 
4038
3993
index_hint_type:
4039
3994
          FORCE_SYM  { $$= INDEX_HINT_FORCE; }
4040
 
        | IGNORE_SYM { $$= INDEX_HINT_IGNORE; } 
 
3995
        | IGNORE_SYM { $$= INDEX_HINT_IGNORE; }
4041
3996
        ;
4042
3997
 
4043
3998
index_hint_definition:
4120
4075
 
4121
4076
interval_time_stamp:
4122
4077
        interval_time_st        {}
4123
 
        | FRAC_SECOND_SYM       { 
4124
 
                                  $$=INTERVAL_MICROSECOND; 
 
4078
        | FRAC_SECOND_SYM       {
 
4079
                                  $$=INTERVAL_MICROSECOND;
4125
4080
                                  /*
4126
4081
                                    FRAC_SECOND was mistakenly implemented with
4127
4082
                                    a wrong resolution. According to the ODBC
4199
4154
        ;
4200
4155
 
4201
4156
opt_escape:
4202
 
          ESCAPE_SYM simple_expr 
 
4157
          ESCAPE_SYM simple_expr
4203
4158
          {
4204
4159
            Lex->escape_used= true;
4205
4160
            $$= $2;
4307
4262
              */
4308
4263
              Select_Lex *first_sl= unit->first_select();
4309
4264
              if (!unit->is_union() &&
4310
 
                  (first_sl->order_list.elements || 
4311
 
                   first_sl->select_limit) &&            
 
4265
                  (first_sl->order_list.elements ||
 
4266
                   first_sl->select_limit) &&           
4312
4267
                  unit->add_fake_select_lex(lex->session))
4313
4268
                DRIZZLE_YYABORT;
4314
4269
            }
4443
4398
        | select_var_ident {}
4444
4399
        ;
4445
4400
 
4446
 
select_var_ident:  
 
4401
select_var_ident: 
4447
4402
          '@' ident_or_text
4448
4403
          {
4449
4404
            LEX *lex=Lex;
4450
 
            if (lex->result) 
 
4405
            if (lex->result)
4451
4406
              ((select_dumpvar *)lex->result)->var_list.push_back( new my_var($2,0,0,(enum_field_types)0));
4452
4407
            else
4453
4408
              /*
4564
4519
            lex->statement= new(std::nothrow) statement::Insert(YYSession);
4565
4520
            if (lex->statement == NULL)
4566
4521
              DRIZZLE_YYABORT;
4567
 
            lex->duplicates= DUP_ERROR; 
 
4522
            lex->duplicates= DUP_ERROR;
4568
4523
            mysql_init_select(lex);
4569
4524
            /* for subselects */
4570
4525
            lex->lock_option= TL_READ;
4727
4682
            if (lex->statement == NULL)
4728
4683
              DRIZZLE_YYABORT;
4729
4684
            lex->lock_option= TL_UNLOCK; /* Will be set later */
4730
 
            lex->duplicates= DUP_ERROR; 
 
4685
            lex->duplicates= DUP_ERROR;
4731
4686
            if (!lex->select_lex.add_table_to_list(YYSession, $3, NULL,0))
4732
4687
              DRIZZLE_YYABORT;
4733
4688
          }
4773
4728
          simple_ident_nospvar equal expr_or_default
4774
4729
          {
4775
4730
          LEX *lex= Lex;
4776
 
          if (lex->update_list.push_back($1) || 
 
4731
          if (lex->update_list.push_back($1) ||
4777
4732
              lex->value_list.push_back($3))
4778
4733
              DRIZZLE_YYABORT;
4779
4734
          }
4814
4769
        ;
4815
4770
 
4816
4771
opt_delete_option:
4817
 
          QUICK        { Lex->current_select->options|= OPTION_QUICK; }
4818
 
        | IGNORE_SYM   { Lex->ignore= 1; }
 
4772
         IGNORE_SYM   { Lex->ignore= 1; }
4819
4773
        ;
4820
4774
 
4821
4775
truncate:
4900
4854
              DRIZZLE_YYABORT;
4901
4855
          }
4902
4856
        | ENGINE_SYM ident_or_text STATUS_SYM /* This should either go... well it should go */
4903
 
          { 
 
4857
          {
4904
4858
            Lex->sql_command= SQLCOM_SHOW_ENGINE_STATUS;
4905
 
            Lex->statement= 
 
4859
            Lex->statement=
4906
4860
              new(std::nothrow) statement::ShowEngineStatus(YYSession, $2.str);
4907
4861
            if (Lex->statement == NULL)
4908
4862
              DRIZZLE_YYABORT;
4933
4887
              DRIZZLE_YYABORT;
4934
4888
          }
4935
4889
        | COUNT_SYM '(' '*' ')' WARNINGS
4936
 
          { 
4937
 
            (void) create_select_for_variable("warning_count"); 
 
4890
          {
 
4891
            (void) create_select_for_variable("warning_count");
4938
4892
            LEX *lex= Lex;
4939
4893
            lex->statement= new(std::nothrow) statement::Select(YYSession);
4940
4894
            if (lex->statement == NULL)
4941
4895
              DRIZZLE_YYABORT;
4942
4896
          }
4943
4897
        | COUNT_SYM '(' '*' ')' ERRORS
4944
 
          { 
4945
 
            (void) create_select_for_variable("error_count"); 
 
4898
          {
 
4899
            (void) create_select_for_variable("error_count");
4946
4900
            LEX *lex= Lex;
4947
4901
            lex->statement= new(std::nothrow) statement::Select(YYSession);
4948
4902
            if (lex->statement == NULL)
4949
4903
              DRIZZLE_YYABORT;
4950
4904
          }
4951
4905
        | WARNINGS opt_limit_clause_init
4952
 
          { 
 
4906
          {
4953
4907
            Lex->sql_command = SQLCOM_SHOW_WARNS;
4954
4908
            Lex->statement= new(std::nothrow) statement::ShowWarnings(YYSession);
4955
4909
            if (Lex->statement == NULL)
4956
4910
              DRIZZLE_YYABORT;
4957
4911
          }
4958
4912
        | ERRORS opt_limit_clause_init
4959
 
          { 
 
4913
          {
4960
4914
            Lex->sql_command = SQLCOM_SHOW_ERRORS;
4961
4915
            Lex->statement= new(std::nothrow) statement::ShowErrors(YYSession);
4962
4916
            if (Lex->statement == NULL)
4976
4930
              DRIZZLE_YYABORT;
4977
4931
          }
4978
4932
        | opt_full PROCESSLIST_SYM
4979
 
          { 
 
4933
          {
4980
4934
            Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;
4981
 
            Lex->statement= 
 
4935
            Lex->statement=
4982
4936
              new(std::nothrow) statement::ShowProcesslist(YYSession);
4983
4937
            if (Lex->statement == NULL)
4984
4938
              DRIZZLE_YYABORT;
5246
5200
        ;
5247
5201
 
5248
5202
field_term:
5249
 
          TERMINATED BY text_string 
 
5203
          TERMINATED BY text_string
5250
5204
          {
5251
5205
            assert(Lex->exchange != 0);
5252
5206
            Lex->exchange->field_term= $3;
5340
5294
          $$ = new Item_string($1.str, $1.length, session->variables.getCollation());
5341
5295
        }
5342
5296
        | text_literal TEXT_STRING_literal
5343
 
          { 
5344
 
            ((Item_string*) $1)->append($2.str, $2.length); 
 
5297
          {
 
5298
            ((Item_string*) $1)->append($2.str, $2.length);
5345
5299
          }
5346
5300
        ;
5347
5301
 
5646
5600
          keyword_sp            {}
5647
5601
        | BEGIN_SYM             {}
5648
5602
        | BYTE_SYM              {}
5649
 
        | CACHE_SYM             {}
5650
 
        | CHARSET               {}
5651
5603
        | CHECKSUM_SYM          {}
5652
5604
        | CLOSE_SYM             {}
5653
5605
        | COMMENT_SYM           {}
5656
5608
        | DEALLOCATE_SYM        {}
5657
5609
        | END                   {}
5658
5610
        | FLUSH_SYM             {}
5659
 
        | HOST_SYM              {}
5660
 
        | INSTALL_SYM           {}
5661
5611
        | NO_SYM                {}
5662
5612
        | OPEN_SYM              {}
5663
 
        | OPTIONS_SYM           {}
5664
 
        | PORT_SYM              {}
5665
 
        | REMOVE_SYM            {}
5666
 
        | RESET_SYM             {}
5667
5613
        | ROLLBACK_SYM          {}
5668
5614
        | SAVEPOINT_SYM         {}
5669
5615
        | SECURITY_SYM          {}
5670
5616
        | SERVER_SYM            {}
5671
 
        | SOCKET_SYM            {}
5672
 
        | SONAME_SYM            {}
5673
5617
        | START_SYM             {}
5674
5618
        | STOP_SYM              {}
5675
5619
        | TRUNCATE_SYM          {}
5691
5635
        | AUTO_INC                 {}
5692
5636
        | AVG_ROW_LENGTH           {}
5693
5637
        | AVG_SYM                  {}
5694
 
        | BINLOG_SYM               {}
5695
5638
        | BIT_SYM                  {}
5696
5639
        | BLOCK_SIZE_SYM           {}
5697
5640
        | BLOCK_SYM                {}
5700
5643
        | BTREE_SYM                {}
5701
5644
        | CASCADED                 {}
5702
5645
        | CHAIN_SYM                {}
5703
 
        | CHANGED                  {}
5704
5646
        | COALESCE                 {}
5705
5647
        | COLLATION_SYM            {}
5706
5648
        | COLUMN_FORMAT_SYM        {}
5707
5649
        | COLUMNS                  {}
5708
5650
        | COMMITTED_SYM            {}
5709
5651
        | COMPACT_SYM              {}
5710
 
        | COMPLETION_SYM           {}
5711
5652
        | COMPRESSED_SYM           {}
5712
5653
        | CONCURRENT               {}
5713
5654
        | CONNECTION_SYM           {}
5714
5655
        | CONSISTENT_SYM           {}
5715
 
        | CONTEXT_SYM              {}
5716
5656
        | CUBE_SYM                 {}
5717
5657
        | DATA_SYM                 {}
5718
5658
        | DATAFILE_SYM             {}
5731
5671
        | ESCAPE_SYM               {}
5732
5672
        | EXCLUSIVE_SYM            {}
5733
5673
        | EXTENDED_SYM             {}
5734
 
        | EXTENT_SIZE_SYM          {}
5735
 
        | FAST_SYM                 {}
5736
5674
        | FOUND_SYM                {}
5737
5675
        | ENABLE_SYM               {}
5738
5676
        | FULL                     {}
5742
5680
        | FRAC_SECOND_SYM          {}
5743
5681
        | GLOBAL_SYM               {}
5744
5682
        | HASH_SYM                 {}
5745
 
        | HOSTS_SYM                {}
5746
5683
        | HOUR_SYM                 {}
5747
5684
        | IDENTIFIED_SYM           {}
5748
5685
        | IMPORT                   {}
5749
5686
        | INDEXES                  {}
5750
5687
        | ISOLATION                {}
5751
 
        | INSERT_METHOD            {}
5752
5688
        | KEY_BLOCK_SIZE           {}
5753
5689
        | LAST_SYM                 {}
5754
5690
        | LEVEL_SYM                {}
5762
5698
        | MEDIUM_SYM               {}
5763
5699
        | MERGE_SYM                {}
5764
5700
        | MICROSECOND_SYM          {}
5765
 
        | MIGRATE_SYM              {}
5766
5701
        | MINUTE_SYM               {}
5767
5702
        | MIN_ROWS                 {}
5768
5703
        | MODIFY_SYM               {}
5773
5708
        | NATIONAL_SYM             {}
5774
5709
        | NEXT_SYM                 {}
5775
5710
        | NEW_SYM                  {}
5776
 
        | NO_WAIT_SYM              {}
5777
 
        | NODEGROUP_SYM            {}
5778
5711
        | NONE_SYM                 {}
5779
 
        | NOWAIT_SYM               {}
5780
5712
        | OFFLINE_SYM              {}
5781
5713
        | OFFSET_SYM               {}
5782
5714
        | ONE_SHOT_SYM             {}
5785
5717
        | PAGE_SYM                 {}
5786
5718
        | PARTIAL                  {}
5787
5719
        | PHASE_SYM                {}
5788
 
        | POINT_SYM                {}
5789
5720
        | PREV_SYM                 {}
5790
5721
        | PROCESS                  {}
5791
5722
        | PROCESSLIST_SYM          {}
5792
5723
        | QUARTER_SYM              {}
5793
5724
        | QUERY_SYM                {}
5794
 
        | QUICK                    {}
5795
5725
        | READ_ONLY_SYM            {}
5796
 
        | REBUILD_SYM              {}
5797
 
        | RECOVER_SYM              {}
5798
 
        | REDO_BUFFER_SIZE_SYM     {}
5799
 
        | REDOFILE_SYM             {}
5800
5726
        | REDUNDANT_SYM            {}
5801
 
        | RELOAD                   {}
5802
 
        | REORGANIZE_SYM           {}
5803
5727
        | REPEATABLE_SYM           {}
5804
 
        | REPLICATION              {}
5805
 
        | RESOURCES                {}
5806
 
        | RESUME_SYM               {}
5807
5728
        | RETURNS_SYM              {}
5808
5729
        | REVERSE_SYM              {}
5809
5730
        | ROLLUP_SYM               {}
5819
5740
        | SHARE_SYM                {}
5820
5741
        | SHUTDOWN                 {}
5821
5742
        | SNAPSHOT_SYM             {}
5822
 
        | SOURCE_SYM               {}
5823
5743
        | SQL_BUFFER_RESULT        {}
5824
 
        | STARTS_SYM               {}
5825
5744
        | STATUS_SYM               {}
5826
5745
        | STORAGE_SYM              {}
5827
5746
        | STRING_SYM               {}
5833
5752
        | TABLES                   {}
5834
5753
        | TABLESPACE               {}
5835
5754
        | TEMPORARY_SYM            {}
5836
 
        | TEMPTABLE_SYM            {}
5837
5755
        | TEXT_SYM                 {}
5838
 
        | THAN_SYM                 {}
5839
5756
        | TRANSACTION_SYM          {}
5840
5757
        | TIMESTAMP_SYM            {}
5841
5758
        | TIMESTAMP_ADD            {}
5843
5760
        | TYPES_SYM                {}
5844
5761
        | TYPE_SYM                 {}
5845
5762
        | UNCOMMITTED_SYM          {}
5846
 
        | UNDEFINED_SYM            {}
5847
5763
        | UNDOFILE_SYM             {}
5848
5764
        | UNKNOWN_SYM              {}
5849
 
        | UNTIL_SYM                {}
5850
5765
        | USER                     {}
5851
5766
        | VARIABLES                {}
5852
5767
        | VALUE_SYM                {}
5853
5768
        | WARNINGS                 {}
5854
 
        | WAIT_SYM                 {}
5855
5769
        | WEEK_SYM                 {}
5856
5770
        | WEIGHT_STRING_SYM        {}
5857
5771
        | WORK_SYM                 {}
6057
5971
            lex->statement= statement;
6058
5972
            if (lex->statement == NULL)
6059
5973
              DRIZZLE_YYABORT;
6060
 
            statement->tx_chain= $3; 
 
5974
            statement->tx_chain= $3;
6061
5975
            statement->tx_release= $4;
6062
5976
          }
6063
5977
        ;
6071
5985
            lex->statement= statement;
6072
5986
            if (lex->statement == NULL)
6073
5987
              DRIZZLE_YYABORT;
6074
 
            statement->tx_chain= $3; 
 
5988
            statement->tx_chain= $3;
6075
5989
            statement->tx_release= $4;
6076
5990
          }
6077
5991
        | ROLLBACK_SYM opt_work
6179
6093
 
6180
6094
query_specification:
6181
6095
          SELECT_SYM select_init2_derived
6182
 
          { 
 
6096
          {
6183
6097
            $$= Lex->current_select->master_unit()->first_select();
6184
6098
          }
6185
6099
        | '(' select_paren_derived ')'
6191
6105
query_expression_body:
6192
6106
          query_specification
6193
6107
        | query_expression_body
6194
 
          UNION_SYM union_option 
 
6108
          UNION_SYM union_option
6195
6109
          {
6196
6110
            if (add_select_to_union_list(Lex, (bool)$3))
6197
6111
              DRIZZLE_YYABORT;
6206
6120
/* Corresponds to <query expression> in the SQL:2003 standard. */
6207
6121
subselect:
6208
6122
          subselect_start query_expression_body subselect_end
6209
 
          { 
 
6123
          {
6210
6124
            $$= $2;
6211
6125
          }
6212
6126
        ;
6219
6133
              my_parse_error(ER(ER_SYNTAX_ERROR));
6220
6134
              DRIZZLE_YYABORT;
6221
6135
            }
6222
 
            /* 
 
6136
            /*
6223
6137
              we are making a "derived table" for the parenthesis
6224
 
              as we need to have a lex level to fit the union 
6225
 
              after the parenthesis, e.g. 
6226
 
              (SELECT .. ) UNION ...  becomes 
 
6138
              as we need to have a lex level to fit the union
 
6139
              after the parenthesis, e.g.
 
6140
              (SELECT .. ) UNION ...  becomes
6227
6141
              SELECT * FROM ((SELECT ...) UNION ...)
6228
6142
            */
6229
6143
            if (mysql_new_select(Lex, 1))