~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/join.cc

  • Committer: Lee Bieber
  • Date: 2011-02-24 03:20:47 UTC
  • mfrom: (2196.1.4 build)
  • Revision ID: kalebral@gmail.com-20110224032047-avmw06iwww3m73cw
Merge Andrew - 723653: Docs day first pass fixes 
Merge Brian - Puts back in support for COM_KILL, Also adds back in the INTERACTIVE flag, and creates a DD to track sessions/check on usage
Merge Olaf - Use List::size()

Show diffs side-by-side

added added

removed removed

Lines of Context:
496
496
    } while (item_sum != end);
497
497
  }
498
498
 
499
 
  if (select_lex->inner_refs_list.elements &&
 
499
  if (select_lex->inner_refs_list.size() &&
500
500
      fix_inner_refs(session, all_fields, select_lex, ref_pointer_array))
501
501
    return(-1);
502
502
 
535
535
 
536
536
  /* Init join struct */
537
537
  count_field_types(select_lex, &tmp_table_param, all_fields, 0);
538
 
  ref_pointer_array_size= all_fields.elements*sizeof(Item*);
 
538
  ref_pointer_array_size= all_fields.size() * sizeof(Item*);
539
539
  this->group= group_list != 0;
540
540
  unit= unit_arg;
541
541
 
1163
1163
 
1164
1164
    init_items_ref_array();
1165
1165
 
1166
 
    tmp_table_param.hidden_field_count= (all_fields.elements -
1167
 
           fields_list.elements);
1168
 
    Order *tmp_group= (((not simple_group) or not (getDebug().test(debug::NO_KEY_GROUP))) ? group_list : (Order*) 0);
 
1166
    tmp_table_param.hidden_field_count= all_fields.size() - fields_list.size();
 
1167
    Order *tmp_group= (((not simple_group) or not (getDebug().test(debug::NO_KEY_GROUP))) ? group_list : NULL);
1169
1168
 
1170
1169
    /*
1171
1170
      Pushing LIMIT to the temporary table creation is not applicable
1528
1527
    curr_join->all_fields= *curr_all_fields;
1529
1528
    if (!items1)
1530
1529
    {
1531
 
      items1= items0 + all_fields.elements;
 
1530
      items1= items0 + all_fields.size();
1532
1531
      if (sort_and_group || curr_tmp_table->group)
1533
1532
      {
1534
1533
        if (change_to_use_tmp_fields(session, items1,
1535
1534
                  tmp_fields_list1, tmp_all_fields1,
1536
 
                  fields_list.elements, all_fields))
 
1535
                  fields_list.size(), all_fields))
1537
1536
          return;
1538
1537
      }
1539
1538
      else
1540
1539
      {
1541
1540
        if (change_refs_to_tmp_fields(session, items1,
1542
1541
                    tmp_fields_list1, tmp_all_fields1,
1543
 
                    fields_list.elements, all_fields))
 
1542
                    fields_list.size(), all_fields))
1544
1543
          return;
1545
1544
      }
1546
1545
      curr_join->tmp_all_fields1= tmp_all_fields1;
1590
1589
      count_field_types(select_lex, &curr_join->tmp_table_param,
1591
1590
      curr_join->tmp_all_fields1,
1592
1591
      curr_join->select_distinct && !curr_join->group_list);
1593
 
      curr_join->tmp_table_param.hidden_field_count= curr_join->tmp_all_fields1.elements
1594
 
                                                   - curr_join->tmp_fields_list1.elements;
 
1592
      curr_join->tmp_table_param.hidden_field_count= curr_join->tmp_all_fields1.size()
 
1593
                                                   - curr_join->tmp_fields_list1.size();
1595
1594
 
1596
1595
      if (exec_tmp_table2)
1597
1596
      {
1677
1676
      // No sum funcs anymore
1678
1677
      if (!items2)
1679
1678
      {
1680
 
        items2= items1 + all_fields.elements;
 
1679
        items2= items1 + all_fields.size();
1681
1680
        if (change_to_use_tmp_fields(session, items2,
1682
1681
                  tmp_fields_list2, tmp_all_fields2,
1683
 
                  fields_list.elements, tmp_all_fields1))
 
1682
                  fields_list.size(), tmp_all_fields1))
1684
1683
          return;
1685
1684
        curr_join->tmp_fields_list2= tmp_fields_list2;
1686
1685
        curr_join->tmp_all_fields2= tmp_all_fields2;
1725
1724
    {
1726
1725
      if (! items0)
1727
1726
        init_items_ref_array();
1728
 
      items3= ref_pointer_array + (all_fields.elements*4);
 
1727
      items3= ref_pointer_array + (all_fields.size() * 4);
1729
1728
      setup_copy_fields(session, &curr_join->tmp_table_param,
1730
1729
      items3, tmp_fields_list3, tmp_all_fields3,
1731
 
      curr_fields_list->elements, *curr_all_fields);
 
1730
      curr_fields_list->size(), *curr_all_fields);
1732
1731
      tmp_table_param.save_copy_funcs= curr_join->tmp_table_param.copy_funcs;
1733
1732
      tmp_table_param.save_copy_field= curr_join->tmp_table_param.copy_field;
1734
1733
      tmp_table_param.save_copy_field_end= curr_join->tmp_table_param.copy_field_end;
2175
2174
  */
2176
2175
  if (select_distinct)
2177
2176
  {
2178
 
    group_parts+= fields_list.elements;
 
2177
    group_parts+= fields_list.size();
2179
2178
    /*
2180
2179
      If the order_st clause is specified then it's possible that
2181
2180
      it also will be optimized, so reserve space for it too
2283
2282
    List<Item> *rollup_fields= &rollup.getFields()[i];
2284
2283
    rollup_fields->clear();
2285
2284
    rollup.getRefPointerArrays()[i]= ref_array;
2286
 
    ref_array+= all_fields.elements;
 
2285
    ref_array+= all_fields.size();
2287
2286
  }
2288
2287
 
2289
2288
  for (uint32_t i= 0 ; i < send_group_parts; i++)
2290
2289
  {
2291
 
    for (uint32_t j= 0 ; j < fields_list.elements ; j++)
 
2290
    for (uint32_t j= 0 ; j < fields_list.size() ; j++)
2292
2291
    {
2293
2292
      rollup.getFields()[i].push_back(rollup.getNullItems()[i]);
2294
2293
    }
2405
2404
    Order *start_group;
2406
2405
 
2407
2406
    /* Point to first hidden field */
2408
 
    Item **ref_array= ref_array_start + fields_arg.elements-1;
 
2407
    Item **ref_array= ref_array_start + fields_arg.size()-1;
2409
2408
 
2410
2409
    /* Remember where the sum functions ends for the previous level */
2411
2410
    sum_funcs_end[pos+1]= *func;
3169
3168
*/
3170
3169
static bool make_group_fields(Join *main_join, Join *curr_join)
3171
3170
{
3172
 
  if (main_join->group_fields_cache.elements)
 
3171
  if (main_join->group_fields_cache.size())
3173
3172
  {
3174
3173
    curr_join->group_fields= main_join->group_fields_cache;
3175
3174
    curr_join->sort_and_group= 1;
4697
4696
      }
4698
4697
      if (!tab->first_inner)
4699
4698
        tab->first_inner= nested_join->first_nested;
4700
 
      if (++nested_join->counter_ < nested_join->join_list.elements)
 
4699
      if (++nested_join->counter_ < nested_join->join_list.size())
4701
4700
        break;
4702
4701
      /* Table tab is the last inner table for nested join. */
4703
4702
      nested_join->first_nested->last_inner= tab;
6156
6155
            with anything)
6157
6156
        2. we could run out of bits in the nested join bitset otherwise.
6158
6157
      */
6159
 
      if (nested_join->join_list.elements != 1)
 
6158
      if (nested_join->join_list.size() != 1)
6160
6159
      {
6161
6160
        /* Don't assign bits to sj-nests */
6162
6161
        if (table->on_expr)