~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/opt_range.cc

  • Committer: lbieber
  • Date: 2009-06-12 17:51:58 UTC
  • mfrom: (1061 staging)
  • mto: (1061.1.3 merge-all)
  • mto: This revision was merged to the branch mainline in revision 1062.
  • Revision ID: lbieber@lbieber-laptop-20090612175158-v6k2st8gvs81z3dn
sync with latest from trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
2269
2269
 
2270
2270
      param.key[param.keys]=key_parts;
2271
2271
      key_part_info= key_info->key_part;
2272
 
      for (uint32_t part=0 ; part < key_info->key_parts ;
2273
 
           part++, key_parts++, key_part_info++)
 
2272
      for (uint32_t part=0;
 
2273
           part < key_info->key_parts;
 
2274
           part++, key_parts++, key_part_info++)
2274
2275
      {
2275
 
        key_parts->key=          param.keys;
2276
 
        key_parts->part=         part;
2277
 
        key_parts->length=       key_part_info->length;
2278
 
        key_parts->store_length= key_part_info->store_length;
2279
 
        key_parts->field=        key_part_info->field;
2280
 
        key_parts->null_bit=     key_part_info->null_bit;
2281
 
        key_parts->image_type =  Field::itRAW;
 
2276
        key_parts->key= param.keys;
 
2277
        key_parts->part= part;
 
2278
        key_parts->length= key_part_info->length;
 
2279
        key_parts->store_length= key_part_info->store_length;
 
2280
        key_parts->field= key_part_info->field;
 
2281
        key_parts->null_bit= key_part_info->null_bit;
2282
2282
        /* Only HA_PART_KEY_SEG is used */
2283
 
        key_parts->flag=         (uint8_t) key_part_info->key_part_flag;
 
2283
        key_parts->flag= (uint8_t) key_part_info->key_part_flag;
2284
2284
      }
2285
2285
      param.real_keynr[param.keys++]=idx;
2286
2286
    }
4398
4398
  */
4399
4399
  if (field->result_type() == STRING_RESULT &&
4400
4400
      value->result_type() == STRING_RESULT &&
4401
 
      key_part->image_type == Field::itRAW &&
4402
4401
      ((Field_str*)field)->charset() != conf_func->compare_collation() &&
4403
4402
      !(conf_func->compare_collation()->state & MY_CS_BINSORT))
4404
4403
    goto end;
4684
4683
    goto end;
4685
4684
  if (maybe_null)
4686
4685
    *str= (unsigned char) field->is_real_null();        // Set to 1 if null
4687
 
  field->get_key_image(str+maybe_null, key_part->length,
4688
 
                       key_part->image_type);
 
4686
  field->get_key_image(str+maybe_null, key_part->length);
4689
4687
  if (!(tree= new (alloc) SEL_ARG(field, str, str)))
4690
4688
    goto end;                                   // out of memory
4691
4689
 
7824
7822
                       KEY_PART_INFO *last_part, Session *session,
7825
7823
                       unsigned char *key_infix, uint32_t *key_infix_len,
7826
7824
                       KEY_PART_INFO **first_non_infix_part);
7827
 
static bool
7828
 
check_group_min_max_predicates(COND *cond, Item_field *min_max_arg_item,
7829
 
                               Field::imagetype image_type);
 
7825
static bool check_group_min_max_predicates(COND *cond, Item_field *min_max_arg_item);
7830
7826
 
7831
7827
static void
7832
7828
cost_group_min_max(Table* table, KEY *index_info, uint32_t used_key_parts,
8345
8341
 
8346
8342
  /* Check (SA3) for the where clause. */
8347
8343
  if (join->conds && min_max_arg_item &&
8348
 
      !check_group_min_max_predicates(join->conds, min_max_arg_item, Field::itRAW))
 
8344
      ! check_group_min_max_predicates(join->conds, min_max_arg_item))
8349
8345
    return NULL;
8350
8346
 
8351
8347
  /* The query passes all tests, so construct a new TRP object. */
8391
8387
    true  if cond passes the test
8392
8388
    false o/w
8393
8389
*/
8394
 
 
8395
 
static bool
8396
 
check_group_min_max_predicates(COND *cond, Item_field *min_max_arg_item,
8397
 
                               Field::imagetype image_type)
 
8390
static bool check_group_min_max_predicates(COND *cond, Item_field *min_max_arg_item)
8398
8391
{
8399
8392
  assert(cond && min_max_arg_item);
8400
8393
 
8406
8399
    Item *and_or_arg;
8407
8400
    while ((and_or_arg= li++))
8408
8401
    {
8409
 
      if (!check_group_min_max_predicates(and_or_arg, min_max_arg_item,
8410
 
                                         image_type))
 
8402
      if (!check_group_min_max_predicates(and_or_arg, min_max_arg_item))
8411
8403
        return false;
8412
8404
    }
8413
8405
    return true;
8471
8463
              Don't use an index when comparing strings of different collations.
8472
8464
            */
8473
8465
            ((args[1]->result_type() == STRING_RESULT &&
8474
 
              image_type == Field::itRAW &&
8475
8466
              ((Field_str*) min_max_arg_item->field)->charset() !=
8476
8467
              pred->compare_collation())
8477
8468
             ||
8486
8477
    }
8487
8478
    else if (cur_arg->type() == Item::FUNC_ITEM)
8488
8479
    {
8489
 
      if (!check_group_min_max_predicates(cur_arg, min_max_arg_item,
8490
 
                                         image_type))
 
8480
      if (! check_group_min_max_predicates(cur_arg, min_max_arg_item))
8491
8481
        return false;
8492
8482
    }
8493
8483
    else if (cur_arg->const_item())