~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_select.cc

  • Committer: Olaf van der Spek
  • Date: 2011-06-22 22:39:31 UTC
  • mto: This revision was merged to the branch mainline in revision 2348.
  • Revision ID: olafvdspek@gmail.com-20110622223931-z6r8g68zp401kkbe
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
549
549
                         Select_Lex *select_lex,
550
550
                         vector<optimizer::SargableParam> &sargables)
551
551
{
552
 
  uint  and_level,found_eq_constant;
553
 
  optimizer::KeyField *key_fields, *end, *field;
554
 
  uint32_t sz;
555
552
  uint32_t m= max(select_lex->max_equal_elems,(uint32_t)1);
556
553
 
557
554
  /*
571
568
    can be not more than select_lex->max_equal_elems such
572
569
    substitutions.
573
570
  */
574
 
  sz= sizeof(optimizer::KeyField) *
575
 
      (((session->lex().current_select->cond_count+1)*2 +
576
 
        session->lex().current_select->between_count)*m+1);
577
 
  key_fields= (optimizer::KeyField*) session->mem.alloc(sz);
578
 
  and_level= 0;
 
571
  optimizer::KeyField* key_fields= new (session->mem) optimizer::KeyField[((session->lex().current_select->cond_count+1)*2 + session->lex().current_select->between_count)*m+1];
 
572
  uint and_level= 0;
 
573
  optimizer::KeyField* end, *field;
579
574
  field= end= key_fields;
580
575
 
581
576
  my_init_dynamic_array(keyuse, sizeof(optimizer::KeyUse), 20, 64);
648
643
 
649
644
    use= save_pos= (optimizer::KeyUse*)keyuse->buffer;
650
645
    prev= &key_end;
651
 
    found_eq_constant= 0;
 
646
    uint found_eq_constant= 0;
652
647
    {
653
648
      uint32_t i;
654
649
 
1000
995
  j->ref.key_length=length;
1001
996
  j->ref.key=(int) key;
1002
997
  j->ref.key_buff= (unsigned char*) session->mem.calloc(ALIGN_SIZE(length)*2);
1003
 
  j->ref.key_copy= (StoredKey**) session->mem.alloc((sizeof(StoredKey*) * (keyparts+1)));
1004
 
  j->ref.items=    (Item**) session->mem.alloc(sizeof(Item*)*keyparts);
1005
 
  j->ref.cond_guards= (bool**) session->mem.alloc(sizeof(uint*)*keyparts);
 
998
  j->ref.key_copy= new (session->mem) StoredKey*[keyparts + 1];
 
999
  j->ref.items= new (session->mem) Item*[keyparts];
 
1000
  j->ref.cond_guards= new (session->mem) bool*[keyparts];
1006
1001
  j->ref.key_buff2=j->ref.key_buff+ALIGN_SIZE(length);
1007
1002
  j->ref.key_err=1;
1008
1003
  j->ref.null_rejecting= 0;