~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/optimizer/key_field.cc

  • Committer: pcrews
  • Date: 2011-05-24 17:36:24 UTC
  • mfrom: (1099.4.232 drizzle)
  • Revision ID: pcrews@lucid32-20110524173624-mwr1bvq6fa1r01ao
Updated translations + 2011.05.18 tarball tag

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include "config.h"
 
21
#include <config.h>
 
22
 
22
23
#include <drizzled/sql_select.h>
23
24
#include <drizzled/nested_join.h>
24
25
#include <drizzled/item/cmpfunc.h>
25
 
#include "drizzled/optimizer/key_field.h"
26
 
#include "drizzled/optimizer/key_use.h"
 
26
#include <drizzled/table.h>
 
27
#include <drizzled/optimizer/key_field.h>
 
28
#include <drizzled/optimizer/key_use.h>
 
29
#include <drizzled/sql_lex.h>
 
30
#include <drizzled/item/subselect.h>
27
31
 
28
32
#include <vector>
29
33
 
61
65
                                   0,
62
66
                                   key_field->rejectNullValues(),
63
67
                                   key_field->getConditionalGuard());
64
 
          insert_dynamic(keyuse_array, (unsigned char*) &keyuse);
 
68
          keyuse_array->push_back(&keyuse);
65
69
        }
66
70
      }
67
71
    }
74
78
                                      uint32_t *and_level,
75
79
                                      vector<optimizer::SargableParam> &sargables)
76
80
{
77
 
  List_iterator<TableList> li(nested_join_table->getNestedJoin()->join_list);
78
 
  List_iterator<TableList> li2(nested_join_table->getNestedJoin()->join_list);
 
81
  List<TableList>::iterator li(nested_join_table->getNestedJoin()->join_list.begin());
 
82
  List<TableList>::iterator li2(nested_join_table->getNestedJoin()->join_list.begin());
79
83
  bool have_another= false;
80
84
  table_map tables= 0;
81
85
  TableList *table;
91
95
        /* It's a semi-join nest. Walk into it as if it wasn't a nest */
92
96
        have_another= true;
93
97
        li2= li;
94
 
        li= List_iterator<TableList>(table->getNestedJoin()->join_list);
 
98
        li= List<TableList>::iterator(table->getNestedJoin()->join_list.begin());
95
99
      }
96
100
      else
97
101
        add_key_fields_for_nj(join, table, end, and_level, sargables);
399
403
      Add to the set of possible key values every substitution of
400
404
      the field for an equal field included into item_equal
401
405
    */
402
 
    Item_equal_iterator it(*item_equal);
 
406
    Item_equal_iterator it(item_equal->begin());
403
407
    Item_field *item;
404
408
    while ((item= it++))
405
409
    {
422
426
{
423
427
  if (cond->type() == Item_func::COND_ITEM)
424
428
  {
425
 
    List_iterator_fast<Item> li(*((Item_cond*) cond)->argument_list());
 
429
    List<Item>::iterator li(((Item_cond*) cond)->argument_list()->begin());
426
430
    optimizer::KeyField *org_key_fields= *key_fields;
427
431
 
428
432
    if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
587
591
  case Item_func::OPTIMIZE_EQUAL:
588
592
    Item_equal *item_equal= (Item_equal *) cond;
589
593
    Item *const_item= item_equal->get_const();
590
 
    Item_equal_iterator it(*item_equal);
 
594
    Item_equal_iterator it(item_equal->begin());
591
595
    Item_field *item;
592
596
    if (const_item)
593
597
    {
610
614
        field1=field2 as a condition allowing an index access of the table
611
615
        with field1 by the keys value of field2.
612
616
      */
613
 
      Item_equal_iterator fi(*item_equal);
 
617
      Item_equal_iterator fi(item_equal->begin());
614
618
      while ((item= fi++))
615
619
      {
616
620
        Field *field= item->field;
623
627
                          sargables);
624
628
          }
625
629
        }
626
 
        it.rewind();
 
630
        it= item_equal->begin();
627
631
      }
628
632
    }
629
633
    break;