~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/optimizer/range.cc

  • Committer: Olaf van der Spek
  • Date: 2011-06-22 21:57:14 UTC
  • mto: This revision was merged to the branch mainline in revision 2348.
  • Revision ID: olafvdspek@gmail.com-20110622215714-0wmhwrx6of27etov
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
346
346
                                             bool allow_null_cond,
347
347
                                             int *error)
348
348
{
349
 
  optimizer::SqlSelect *select= NULL;
350
 
 
351
349
  *error= 0;
352
350
 
353
351
  if (! conds && ! allow_null_cond)
354
352
  {
355
353
    return 0;
356
354
  }
357
 
  if (! (select= new optimizer::SqlSelect()))
358
 
  {
359
 
    *error= 1;                  // out of memory
360
 
    return 0;
361
 
  }
 
355
  optimizer::SqlSelect* select= new optimizer::SqlSelect;
362
356
  select->read_tables=read_tables;
363
357
  select->const_tables=const_tables;
364
358
  select->head=head;
2543
2537
      tree= get_mm_tree(param,li++);
2544
2538
      if (tree)
2545
2539
      {
2546
 
        Item *item;
2547
 
        while ((item=li++))
 
2540
        while (Item* item= li++)
2548
2541
        {
2549
2542
          optimizer::SEL_TREE *new_tree= get_mm_tree(param,item);
2550
2543
          if (!new_tree)
2770
2763
        tree= &optimizer::null_element;
2771
2764
      goto end;
2772
2765
    }
2773
 
    if (!(tree= new (alloc) optimizer::SEL_ARG(field,is_null_string,is_null_string)))
2774
 
      goto end;                                 // out of memory
 
2766
    tree= new (*alloc) optimizer::SEL_ARG(field,is_null_string,is_null_string);
2775
2767
    if (type == Item_func::ISNOTNULL_FUNC)
2776
2768
    {
2777
2769
      tree->min_flag=NEAR_MIN;              /* IS NOT NULL ->  X > NULL */
4098
4090
  }
4099
4091
 
4100
4092
  /* Get range for retrieving rows in QUICK_SELECT::get_next */
4101
 
  if (! (range= new optimizer::QuickRange(param->min_key,
 
4093
  range= new optimizer::QuickRange(param->min_key,
4102
4094
                                                             (uint32_t) (tmp_min_key - param->min_key),
4103
4095
                                           min_part >=0 ? make_keypart_map(min_part) : 0,
4104
4096
                                                             param->max_key,
4105
4097
                                                             (uint32_t) (tmp_max_key - param->max_key),
4106
4098
                                           max_part >=0 ? make_keypart_map(max_part) : 0,
4107
 
                                                             flag)))
4108
 
  {
4109
 
    return 1;                   // out of memory
4110
 
  }
 
4099
                                                             flag);
4111
4100
 
4112
4101
  set_if_bigger(quick->max_used_key_length, (uint32_t)range->min_length);
4113
4102
  set_if_bigger(quick->max_used_key_length, (uint32_t)range->max_length);
4211
4200
    goto err;
4212
4201
  quick->records= records;
4213
4202
 
4214
 
  if ((cp_buffer_from_ref(session, ref) && session->is_fatal_error) ||
4215
 
      !(range= new(alloc) optimizer::QuickRange()))
 
4203
  if (cp_buffer_from_ref(session, ref) && session->is_fatal_error)
4216
4204
    goto err;                                   // out of memory
 
4205
  range= new (*alloc) optimizer::QuickRange;
4217
4206
 
4218
4207
  range->min_key= range->max_key= ref->key_buff;
4219
4208
  range->min_length= range->max_length= ref->key_length;
5547
5536
  }
5548
5537
  string final(covered_fields_size - res.length(), '0');
5549
5538
  final.append(res);
5550
 
  return (boost::dynamic_bitset<>(final));
 
5539
  return boost::dynamic_bitset<>(final);
5551
5540
}
5552
5541
 
5553
5542