~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Brian Aker
  • Date: 2009-02-07 22:02:41 UTC
  • Revision ID: brian@tangent.org-20090207220241-ez3828o1246ab2sp
Removing on typedeffed class.

Show diffs side-by-side

added added

removed removed

Lines of Context:
254
254
    if (expr2->substype() == Item_subselect::SINGLEROW_SUBS)
255
255
    {
256
256
      Item_singlerow_subselect *expr3 = (Item_singlerow_subselect*) expr2;
257
 
      st_select_lex *subselect;
 
257
      Select_Lex *subselect;
258
258
 
259
259
      /*
260
260
        Implement the mandated change, by altering the semantic tree:
283
283
}
284
284
 
285
285
/**
286
 
   @brief Creates a new SELECT_LEX for a UNION branch.
 
286
   @brief Creates a new Select_Lex for a UNION branch.
287
287
 
288
 
   Sets up and initializes a SELECT_LEX structure for a query once the parser
289
 
   discovers a UNION token. The current SELECT_LEX is pushed on the stack and
290
 
   the new SELECT_LEX becomes the current one..=
 
288
   Sets up and initializes a Select_Lex structure for a query once the parser
 
289
   discovers a UNION token. The current Select_Lex is pushed on the stack and
 
290
   the new Select_Lex becomes the current one..=
291
291
 
292
292
   @lex The parser state.
293
293
 
323
323
}
324
324
 
325
325
/**
326
 
   @brief Initializes a SELECT_LEX for a query within parentheses (aka
 
326
   @brief Initializes a Select_Lex for a query within parentheses (aka
327
327
   braces).
328
328
 
329
329
   @return false if successful, true if an error was reported. In the latter
331
331
 */
332
332
bool setup_select_in_parentheses(LEX *lex) 
333
333
{
334
 
  SELECT_LEX * sel= lex->current_select;
 
334
  Select_Lex * sel= lex->current_select;
335
335
  if (sel->set_braces(1))
336
336
  {
337
337
    my_parse_error(ER(ER_SYNTAX_ERROR));
395
395
  struct st_table_lock_info table_lock_info;
396
396
  interval_type interval, interval_time_st;
397
397
  enum enum_drizzle_timestamp_type date_time_type;
398
 
  st_select_lex *select_lex;
 
398
  Select_Lex *select_lex;
399
399
  chooser_compare_func_creator boolfunc2creator;
400
400
  struct sp_cond_type *spcondtype;
401
401
  struct { int vars, conds, hndlrs, curs; } spblock;
2591
2591
          table_ident TO_SYM table_ident
2592
2592
          {
2593
2593
            LEX *lex=Lex;
2594
 
            SELECT_LEX *sl= lex->current_select;
 
2594
            Select_Lex *sl= lex->current_select;
2595
2595
            if (!sl->add_table_to_list(lex->session, $1,NULL,TL_OPTION_UPDATING,
2596
2596
                                       TL_IGNORE) ||
2597
2597
                !sl->add_table_to_list(lex->session, $3,NULL,TL_OPTION_UPDATING,
2686
2686
          select_part2
2687
2687
          {
2688
2688
            LEX *lex= Lex;
2689
 
            SELECT_LEX * sel= lex->current_select;
 
2689
            Select_Lex * sel= lex->current_select;
2690
2690
            if (lex->current_select->set_braces(0))
2691
2691
            {
2692
2692
              my_parse_error(ER(ER_SYNTAX_ERROR));
2705
2705
select_part2:
2706
2706
          {
2707
2707
            LEX *lex= Lex;
2708
 
            SELECT_LEX *sel= lex->current_select;
 
2708
            Select_Lex *sel= lex->current_select;
2709
2709
            if (sel->linkage != UNION_TYPE)
2710
2710
              mysql_init_select(lex);
2711
2711
            lex->current_select->parsing_place= SELECT_LIST;
3528
3528
          opt_gconcat_separator
3529
3529
          ')'
3530
3530
          {
3531
 
            SELECT_LEX *sel= Select;
 
3531
            Select_Lex *sel= Select;
3532
3532
            sel->in_sum_expr--;
3533
3533
            $$=new Item_func_group_concat(Lex->current_context(), $3, $5,
3534
3534
                                          sel->gorder_list, $7);
3587
3587
          }
3588
3588
        | order_clause
3589
3589
          {
3590
 
            SELECT_LEX *select= Select;
 
3590
            Select_Lex *select= Select;
3591
3591
            select->gorder_list=
3592
3592
              (SQL_LIST*) sql_memdup((char*) &select->order_list,
3593
3593
                                     sizeof(st_sql_list));
3857
3857
/* Warning - may return NULL in case of incomplete SELECT */
3858
3858
table_factor:
3859
3859
          {
3860
 
            SELECT_LEX *sel= Select;
 
3860
            Select_Lex *sel= Select;
3861
3861
            sel->table_join_options= 0;
3862
3862
          }
3863
3863
          table_ident opt_table_alias opt_key_definition
3872
3872
        | select_derived_init get_select_lex select_derived2
3873
3873
          {
3874
3874
            LEX *lex= Lex;
3875
 
            SELECT_LEX *sel= lex->current_select;
 
3875
            Select_Lex *sel= lex->current_select;
3876
3876
            if ($1)
3877
3877
            {
3878
3878
              if (sel->set_braces(1))
3928
3928
                 are no outer parentheses, add_table_to_list() will throw
3929
3929
                 error in this case */
3930
3930
              LEX *lex=Lex;
3931
 
              SELECT_LEX *sel= lex->current_select;
3932
 
              SELECT_LEX_UNIT *unit= sel->master_unit();
 
3931
              Select_Lex *sel= lex->current_select;
 
3932
              Select_Lex_UNIT *unit= sel->master_unit();
3933
3933
              lex->current_select= sel= unit->outer_select();
3934
3934
              if (!($$= sel->add_table_to_list(lex->session,
3935
3935
                                               new Table_ident(unit), $5, 0,
3975
3975
          select_part2_derived
3976
3976
          {
3977
3977
            LEX *lex= Lex;
3978
 
            SELECT_LEX * sel= lex->current_select;
 
3978
            Select_Lex * sel= lex->current_select;
3979
3979
            if (lex->current_select->set_braces(0))
3980
3980
            {
3981
3981
              my_parse_error(ER(ER_SYNTAX_ERROR));
3994
3994
select_part2_derived:
3995
3995
          {
3996
3996
            LEX *lex= Lex;
3997
 
            SELECT_LEX *sel= lex->current_select;
 
3997
            Select_Lex *sel= lex->current_select;
3998
3998
            if (sel->linkage != UNION_TYPE)
3999
3999
              mysql_init_select(lex);
4000
4000
            lex->current_select->parsing_place= SELECT_LIST;
4062
4062
          {
4063
4063
            LEX *lex= Lex;
4064
4064
 
4065
 
            SELECT_LEX *sel= lex->current_select;
 
4065
            Select_Lex *sel= lex->current_select;
4066
4066
            TableList *embedding;
4067
4067
            if (!sel->embedding || sel->end_nested_join(lex->session))
4068
4068
            {
4239
4239
          }
4240
4240
          expr
4241
4241
          {
4242
 
            SELECT_LEX *select= Select;
 
4242
            Select_Lex *select= Select;
4243
4243
            select->where= $3;
4244
4244
            select->parsing_place= NO_MATTER;
4245
4245
            if ($3)
4255
4255
          }
4256
4256
          expr
4257
4257
          {
4258
 
            SELECT_LEX *sel= Select;
 
4258
            Select_Lex *sel= Select;
4259
4259
            sel->having= $3;
4260
4260
            sel->parsing_place= NO_MATTER;
4261
4261
            if ($3)
4350
4350
          ORDER_SYM BY
4351
4351
          {
4352
4352
            LEX *lex=Lex;
4353
 
            SELECT_LEX *sel= lex->current_select;
4354
 
            SELECT_LEX_UNIT *unit= sel-> master_unit();
 
4353
            Select_Lex *sel= lex->current_select;
 
4354
            Select_Lex_UNIT *unit= sel-> master_unit();
4355
4355
            if (sel->linkage != GLOBAL_OPTIONS_TYPE &&
4356
4356
                sel->olap != UNSPECIFIED_OLAP_TYPE &&
4357
4357
                (sel->linkage != UNION_TYPE || sel->braces))
4367
4367
                executed in the same way as the query
4368
4368
                SELECT ... ORDER BY order_list
4369
4369
                unless the SELECT construct contains ORDER BY or LIMIT clauses.
4370
 
                Otherwise we create a fake SELECT_LEX if it has not been created
 
4370
                Otherwise we create a fake Select_Lex if it has not been created
4371
4371
                yet.
4372
4372
              */
4373
 
              SELECT_LEX *first_sl= unit->first_select();
 
4373
              Select_Lex *first_sl= unit->first_select();
4374
4374
              if (!unit->is_union() &&
4375
4375
                  (first_sl->order_list.elements || 
4376
4376
                   first_sl->select_limit) &&            
4398
4398
          /* empty */
4399
4399
          {
4400
4400
            LEX *lex= Lex;
4401
 
            SELECT_LEX *sel= lex->current_select;
 
4401
            Select_Lex *sel= lex->current_select;
4402
4402
            sel->offset_limit= 0;
4403
4403
            sel->select_limit= 0;
4404
4404
          }
4417
4417
limit_options:
4418
4418
          limit_option
4419
4419
          {
4420
 
            SELECT_LEX *sel= Select;
 
4420
            Select_Lex *sel= Select;
4421
4421
            sel->select_limit= $1;
4422
4422
            sel->offset_limit= 0;
4423
4423
            sel->explicit_limit= 1;
4424
4424
          }
4425
4425
        | limit_option ',' limit_option
4426
4426
          {
4427
 
            SELECT_LEX *sel= Select;
 
4427
            Select_Lex *sel= Select;
4428
4428
            sel->select_limit= $3;
4429
4429
            sel->offset_limit= $1;
4430
4430
            sel->explicit_limit= 1;
4431
4431
          }
4432
4432
        | limit_option OFFSET_SYM limit_option
4433
4433
          {
4434
 
            SELECT_LEX *sel= Select;
 
4434
            Select_Lex *sel= Select;
4435
4435
            sel->select_limit= $1;
4436
4436
            sel->offset_limit= $3;
4437
4437
            sel->explicit_limit= 1;
4452
4452
          }
4453
4453
        | LIMIT limit_option
4454
4454
          {
4455
 
            SELECT_LEX *sel= Select;
 
4455
            Select_Lex *sel= Select;
4456
4456
            sel->select_limit= $2;
4457
4457
            sel->explicit_limit= 1;
4458
4458
          }
5573
5573
table_wild:
5574
5574
          ident '.' '*'
5575
5575
          {
5576
 
            SELECT_LEX *sel= Select;
 
5576
            Select_Lex *sel= Select;
5577
5577
            $$ = new Item_field(Lex->current_context(), NULL, $1.str, "*");
5578
5578
            sel->with_wild++;
5579
5579
          }
5580
5580
        | ident '.' ident '.' '*'
5581
5581
          {
5582
 
            SELECT_LEX *sel= Select;
 
5582
            Select_Lex *sel= Select;
5583
5583
            $$ = new Item_field(Lex->current_context(), (YYSession->client_capabilities &
5584
5584
                                CLIENT_NO_SCHEMA ? NULL : $1.str),
5585
5585
                                $3.str,"*");
5595
5595
          ident
5596
5596
          {
5597
5597
            {
5598
 
              SELECT_LEX *sel=Select;
 
5598
              Select_Lex *sel=Select;
5599
5599
              $$= (sel->parsing_place != IN_HAVING ||
5600
5600
                  sel->get_in_sum_expr() > 0) ?
5601
5601
                  (Item*) new Item_field(Lex->current_context(),
5610
5610
simple_ident_nospvar:
5611
5611
          ident
5612
5612
          {
5613
 
            SELECT_LEX *sel=Select;
 
5613
            Select_Lex *sel=Select;
5614
5614
            $$= (sel->parsing_place != IN_HAVING ||
5615
5615
                sel->get_in_sum_expr() > 0) ?
5616
5616
                (Item*) new Item_field(Lex->current_context(),
5628
5628
            LEX *lex= session->lex;
5629
5629
 
5630
5630
            {
5631
 
              SELECT_LEX *sel= lex->current_select;
 
5631
              Select_Lex *sel= lex->current_select;
5632
5632
              if (sel->no_table_names_allowed)
5633
5633
              {
5634
5634
                my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
5646
5646
          {
5647
5647
            Session *session= YYSession;
5648
5648
            LEX *lex= session->lex;
5649
 
            SELECT_LEX *sel= lex->current_select;
 
5649
            Select_Lex *sel= lex->current_select;
5650
5650
            if (sel->no_table_names_allowed)
5651
5651
            {
5652
5652
              my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
5662
5662
          {
5663
5663
            Session *session= YYSession;
5664
5664
            LEX *lex= session->lex;
5665
 
            SELECT_LEX *sel= lex->current_select;
 
5665
            Select_Lex *sel= lex->current_select;
5666
5666
            if (sel->no_table_names_allowed)
5667
5667
            {
5668
5668
              my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
6424
6424
            Session *session= YYSession;
6425
6425
            LEX *lex= session->lex;
6426
6426
            assert(lex->current_select->linkage != GLOBAL_OPTIONS_TYPE);
6427
 
            SELECT_LEX *sel= lex->current_select;
6428
 
            SELECT_LEX_UNIT *unit= sel->master_unit();
6429
 
            SELECT_LEX *fake= unit->fake_select_lex;
 
6427
            Select_Lex *sel= lex->current_select;
 
6428
            Select_Lex_UNIT *unit= sel->master_unit();
 
6429
            Select_Lex *fake= unit->fake_select_lex;
6430
6430
            if (fake)
6431
6431
            {
6432
6432
              unit->global_parameters= fake;
6512
6512
          {
6513
6513
            LEX *lex=Lex;
6514
6514
            lex->pop_context();
6515
 
            SELECT_LEX *child= lex->current_select;
 
6515
            Select_Lex *child= lex->current_select;
6516
6516
            lex->current_select = lex->current_select->return_after_parsing();
6517
6517
            lex->nest_level--;
6518
6518
            lex->current_select->n_child_sum_items += child->n_sum_items;