~dshrews/drizzle/bug614061-alter-schema

« back to all changes in this revision

Viewing changes to drizzled/sql_select.cc

Merge in Andrew

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
static Item* part_of_refkey(Table *form,Field *field);
79
79
static bool cmp_buffer_with_ref(JoinTable *tab);
80
80
static void change_cond_ref_to_const(Session *session,
81
 
                                     vector<COND_CMP>& save_list,
 
81
                                     list<COND_CMP>& save_list,
82
82
                                     Item *and_father,
83
83
                                     Item *cond,
84
84
                                     Item *field,
2364
2364
  and_level
2365
2365
*/
2366
2366
static void change_cond_ref_to_const(Session *session,
2367
 
                                     vector<COND_CMP>& save_list,
 
2367
                                     list<COND_CMP>& save_list,
2368
2368
                                     Item *and_father,
2369
2369
                                     Item *cond,
2370
2370
                                     Item *field,
2470
2470
}
2471
2471
 
2472
2472
static void propagate_cond_constants(Session *session, 
2473
 
                                     vector<COND_CMP>& save_list, 
 
2473
                                     list<COND_CMP>& save_list, 
2474
2474
                                     COND *and_father, 
2475
2475
                                     COND *cond)
2476
2476
{
2479
2479
    bool and_level= ((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC;
2480
2480
    List_iterator_fast<Item> li(*((Item_cond*) cond)->argument_list());
2481
2481
    Item *item;
2482
 
    vector<COND_CMP> save;
 
2482
    list<COND_CMP> save;
2483
2483
    while ((item=li++))
2484
2484
    {
2485
2485
      propagate_cond_constants(session, save, and_level ? cond : item, item);
2487
2487
    if (and_level)
2488
2488
    {
2489
2489
      // Handle other found items
2490
 
      for (vector<COND_CMP>::iterator iter= save.begin(); iter != save.end(); ++iter)
 
2490
      for (list<COND_CMP>::iterator iter= save.begin(); iter != save.end(); ++iter)
2491
2491
      {
2492
 
        Item **args= iter->cmp_func->arguments();
 
2492
        Item **args= iter->second->arguments();
2493
2493
        if (not args[0]->const_item())
2494
2494
        {
2495
 
          change_cond_ref_to_const(session, save_list, iter->and_level,
2496
 
                                   iter->and_level, args[0], args[1] );
 
2495
          change_cond_ref_to_const(session, save, iter->first,
 
2496
                                   iter->first, args[0], args[1] );
2497
2497
        }
2498
2498
      }
2499
2499
    }
2684
2684
                             &join->cond_equal);
2685
2685
 
2686
2686
    /* change field = field to field = const for each found field = const */
2687
 
    vector<COND_CMP> temp;
 
2687
    list<COND_CMP> temp;
2688
2688
    propagate_cond_constants(session, temp, conds, conds);
2689
2689
    /*
2690
2690
      Remove all instances of item == item