~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/join.cc

Big merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
static uint32_t determine_search_depth(JOIN* join);
85
85
static bool make_simple_join(JOIN *join,Table *tmp_table);
86
86
static void make_outerjoin_info(JOIN *join);
87
 
static bool make_join_select(JOIN *join, optimizer::SQL_SELECT *select,COND *item);
 
87
static bool make_join_select(JOIN *join, optimizer::SqlSelect *select,COND *item);
88
88
static bool make_join_readinfo(JOIN *join, uint64_t options, uint32_t no_jbuf_after);
89
89
static void update_depend_map(JOIN *join);
90
90
static void update_depend_map(JOIN *join, order_st *order);
660
660
     The FROM clause must contain a single non-constant table.
661
661
  */
662
662
  if (tables - const_tables == 1 && (group_list || select_distinct) &&
663
 
      !tmp_table_param.sum_func_count &&
664
 
      (!join_tab[const_tables].select ||
665
 
       !join_tab[const_tables].select->quick ||
 
663
      ! tmp_table_param.sum_func_count &&
 
664
      (! join_tab[const_tables].select ||
 
665
       ! join_tab[const_tables].select->quick ||
666
666
       join_tab[const_tables].select->quick->get_type() !=
667
 
       optimizer::QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX))
 
667
       optimizer::QuickSelectInterface::QS_TYPE_GROUP_MIN_MAX))
668
668
  {
669
669
    if (group_list && list_contains_unique_index(join_tab[const_tables].table, find_field_in_order_list, (void *) group_list))
670
670
    {
683
683
          If GROUP BY is a prefix of order_st BY, then it is safe to leave
684
684
          'order' as is.
685
685
       */
686
 
      if (!order || test_if_subpart(group_list, order))
 
686
      if (! order || test_if_subpart(group_list, order))
687
687
          order= skip_sort_order ? 0 : group_list;
688
688
      /*
689
689
        If we have an IGNORE INDEX FOR GROUP BY(fields) clause, this must be
1551
1551
      if (sort_table_cond)
1552
1552
      {
1553
1553
        if (!curr_table->select)
1554
 
          if (!(curr_table->select= new optimizer::SQL_SELECT))
 
1554
          if (!(curr_table->select= new optimizer::SqlSelect))
1555
1555
            return;
1556
1556
        if (!curr_table->select->cond)
1557
1557
          curr_table->select->cond= sort_table_cond;
2609
2609
      join->session->send_kill_message();
2610
2610
      return NESTED_LOOP_KILLED;
2611
2611
    }
2612
 
    optimizer::SQL_SELECT *select= join_tab->select;
 
2612
    optimizer::SqlSelect *select= join_tab->select;
2613
2613
    if (rc == NESTED_LOOP_OK &&
2614
2614
        (!join_tab->cache.select || !join_tab->cache.select->skip_record()))
2615
2615
    {
4427
4427
}
4428
4428
 
4429
4429
static bool make_join_select(JOIN *join,
4430
 
                             optimizer::SQL_SELECT *select,
 
4430
                             optimizer::SqlSelect *select,
4431
4431
                             COND *cond)
4432
4432
{
4433
4433
  Session *session= join->session;
4549
4549
      if (tmp || !cond || tab->type == AM_REF || tab->type == AM_REF_OR_NULL ||
4550
4550
          tab->type == AM_EQ_REF)
4551
4551
      {
4552
 
        optimizer::SQL_SELECT *sel= tab->select= ((optimizer::SQL_SELECT*)
 
4552
        optimizer::SqlSelect *sel= tab->select= ((optimizer::SqlSelect*)
4553
4553
            session->memdup((unsigned char*) select,
4554
4554
              sizeof(*select)));
4555
4555
        if (! sel)
4687
4687
                                         current_map,
4688
4688
                                         current_map, 0)))
4689
4689
            {
4690
 
              tab->cache.select= (optimizer::SQL_SELECT*)
4691
 
                session->memdup((unsigned char*) sel, sizeof(optimizer::SQL_SELECT));
 
4690
              tab->cache.select= (optimizer::SqlSelect*)
 
4691
                session->memdup((unsigned char*) sel, sizeof(optimizer::SqlSelect));
4692
4692
              tab->cache.select->cond= tmp;
4693
4693
              tab->cache.select->read_tables= join->const_table_map;
4694
4694
            }
5881
5881
        !s->table->pos_in_table_list->embedding)
5882
5882
    {
5883
5883
      ha_rows records;
5884
 
      optimizer::SQL_SELECT *select= NULL;
 
5884
      optimizer::SqlSelect *select= NULL;
5885
5885
      select= optimizer::make_select(s->table, found_const_table_map, found_const_table_map, *s->on_expr_ref ? *s->on_expr_ref : conds, 1, &error);
5886
5886
      if (! select)
5887
5887
        return 1;