~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/sql_lex.cc

  • Committer: Brian Aker
  • Date: 2008-07-18 18:55:10 UTC
  • mfrom: (177.1.5 drizzle)
  • Revision ID: brian@tangent.org-20080718185510-o5nnn7g5ub81llqr
Head merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
  next_state(MY_LEX_START),
140
140
  found_semicolon(NULL),
141
141
  ignore_space(1),
142
 
  stmt_prepare_mode(false),
143
142
  in_comment(NO_COMMENT),
144
143
  m_underscore_cs(NULL)
145
144
{
299
298
  lex->value_list.empty();
300
299
  lex->update_list.empty();
301
300
  lex->param_list.empty();
302
 
  lex->view_list.empty();
303
301
  lex->auxiliary_table_list.empty();
304
302
  lex->unit.next= lex->unit.master=
305
303
    lex->unit.link_next= lex->unit.return_to= 0;
830
828
        */
831
829
        lip->restart_token();
832
830
      }
833
 
      else
834
 
      {
835
 
        /*
836
 
          Check for a placeholder: it should not precede a possible identifier
837
 
          because of binlogging: when a placeholder is replaced with
838
 
          its value in a query for the binlog, the query must stay
839
 
          grammatically correct.
840
 
        */
841
 
        if (c == '?' && lip->stmt_prepare_mode && !ident_map[(uint8_t)(lip->yyPeek())])
842
 
        return(PARAM_MARKER);
843
 
      }
844
831
 
845
832
      return((int) c);
846
833
 
1358
1345
    case MY_LEX_SEMICOLON:                      // optional line terminator
1359
1346
      if (lip->yyPeek())
1360
1347
      {
1361
 
        if ((thd->client_capabilities & CLIENT_MULTI_STATEMENTS) && 
1362
 
            !lip->stmt_prepare_mode)
 
1348
        if ((thd->client_capabilities & CLIENT_MULTI_STATEMENTS))
1363
1349
        {
1364
1350
          lip->found_semicolon= lip->get_ptr();
1365
1351
          thd->server_status|= SERVER_MORE_RESULTS_EXISTS;
1577
1563
  embedding= leaf_tables= 0;
1578
1564
  item_list.empty();
1579
1565
  join= 0;
1580
 
  having= prep_having= where= prep_where= 0;
 
1566
  having= where= 0;
1581
1567
  olap= UNSPECIFIED_OLAP_TYPE;
1582
1568
  having_fix_field= 0;
1583
1569
  context.select_lex= this;
1603
1589
  first_execution= 1;
1604
1590
  first_cond_optimization= 1;
1605
1591
  parsing_place= NO_MATTER;
1606
 
  exclude_from_table_unique_test= no_wrap_view_item= false;
 
1592
  exclude_from_table_unique_test= false;
1607
1593
  nest_level= 0;
1608
1594
  link_next= 0;
1609
1595
}
2674
2660
 
2675
2661
 
2676
2662
/*
2677
 
  Save WHERE/HAVING/ON clauses and replace them with disposable copies
2678
 
 
2679
 
  SYNOPSIS
2680
 
    st_select_lex::fix_prepare_information
2681
 
      thd          thread handler
2682
 
      conds        in/out pointer to WHERE condition to be met at execution
2683
 
      having_conds in/out pointer to HAVING condition to be met at execution
2684
 
  
2685
 
  DESCRIPTION
2686
 
    The passed WHERE and HAVING are to be saved for the future executions.
2687
 
    This function saves it, and returns a copy which can be thrashed during
2688
 
    this execution of the statement. By saving/thrashing here we mean only
2689
 
    AND/OR trees.
2690
 
    The function also calls fix_prepare_info_in_table_list that saves all
2691
 
    ON expressions.    
2692
 
*/
2693
 
 
2694
 
void st_select_lex::fix_prepare_information(THD *thd, Item **conds, 
2695
 
                                            Item **having_conds)
2696
 
{
2697
 
  if (thd->stmt_arena->is_conventional() == false && first_execution)
2698
 
  {
2699
 
    first_execution= 0;
2700
 
    if (*conds)
2701
 
    {
2702
 
      prep_where= *conds;
2703
 
      *conds= where= prep_where->copy_andor_structure(thd);
2704
 
    }
2705
 
    if (*having_conds)
2706
 
    {
2707
 
      prep_having= *having_conds;
2708
 
      *having_conds= having= prep_having->copy_andor_structure(thd);
2709
 
    }
2710
 
    fix_prepare_info_in_table_list(thd, (TABLE_LIST *)table_list.first);
2711
 
  }
2712
 
}
2713
 
 
2714
 
 
2715
 
/*
2716
2663
  There are st_select_lex::add_table_to_list &
2717
2664
  st_select_lex::set_lock_for_tables are in sql_parse.cc
2718
2665