~maria-captains/maria/mysql-6.0-backup

« back to all changes in this revision

Viewing changes to sql/item_cmpfunc.cc

  • Committer: Thava Alagu
  • Date: 2010-03-11 19:18:17 UTC
  • mfrom: (3719.14.62 mysql-6.0-codebase)
  • Revision ID: thavamuni.alagu@sun.com-20100311191817-5nigmq884xo9fuut
Merge from mysql-6.0-codebase

Show diffs side-by-side

added added

removed removed

Lines of Context:
483
483
  DTCollation coll;
484
484
  if (args[0]->result_type() == STRING_RESULT &&
485
485
      args[1]->result_type() == STRING_RESULT &&
486
 
      agg_arg_charsets(coll, args, 2, MY_COLL_CMP_CONV, 1))
 
486
      agg_arg_charsets_for_comparison(coll, args, 2))
487
487
    return;
488
488
    
489
489
  args[0]->cmp_context= args[1]->cmp_context=
933
933
    func= &Arg_comparator::compare_datetime;
934
934
    get_value_a_func= &get_datetime_value;
935
935
    get_value_b_func= &get_datetime_value;
 
936
    cmp_collation.set(&my_charset_numeric);
936
937
    return 0;
937
938
  }
938
939
  else if (type == STRING_RESULT && (*a)->field_type() == MYSQL_TYPE_TIME &&
2237
2238
  if ( agg_cmp_type(&cmp_type, args, 3))
2238
2239
    return;
2239
2240
  if (cmp_type == STRING_RESULT &&
2240
 
      agg_arg_charsets(cmp_collation, args, 3, MY_COLL_CMP_CONV, 1))
 
2241
      agg_arg_charsets_for_comparison(cmp_collation, args, 3))
2241
2242
   return;
2242
2243
 
2243
2244
  /*
2438
2439
 
2439
2440
  switch (hybrid_type) {
2440
2441
  case STRING_RESULT:
2441
 
    agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV, 1);
 
2442
    agg_arg_charsets_for_comparison(collation, args, arg_count);
2442
2443
    break;
2443
2444
  case DECIMAL_RESULT:
2444
2445
  case REAL_RESULT:
2613
2614
    agg_result_type(&cached_result_type, args+1, 2);
2614
2615
    if (cached_result_type == STRING_RESULT)
2615
2616
    {
2616
 
      if (agg_arg_charsets(collation, args+1, 2, MY_COLL_ALLOW_CONV, 1))
 
2617
      if (agg_arg_charsets_for_string_result(collation, args + 1, 2))
2617
2618
        return;
2618
2619
    }
2619
2620
    else
2620
2621
    {
2621
 
      collation.set(&my_charset_bin);   // Number
 
2622
      collation.set_numeric(); // Number
2622
2623
    }
2623
2624
    cached_field_type= agg_field_type(args + 1, 2);
2624
2625
  }
2704
2705
    unsigned_flag= args[0]->unsigned_flag;
2705
2706
    cached_result_type= args[0]->result_type();
2706
2707
    if (cached_result_type == STRING_RESULT &&
2707
 
        agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV, 1))
 
2708
        agg_arg_charsets_for_comparison(collation, args, arg_count))
2708
2709
      return;
2709
2710
  }
2710
2711
}
2979
2980
    agg[nagg++]= args[else_expr_num];
2980
2981
  
2981
2982
  agg_result_type(&cached_result_type, agg, nagg);
2982
 
  if ((cached_result_type == STRING_RESULT) &&
2983
 
      agg_arg_charsets(collation, agg, nagg, MY_COLL_ALLOW_CONV, 1))
2984
 
    return;
 
2983
  if (cached_result_type == STRING_RESULT)
 
2984
  {
 
2985
    if (agg_arg_charsets_for_string_result(collation, agg, nagg))
 
2986
      return;
 
2987
  }
 
2988
  else
 
2989
    collation.set_numeric();
2985
2990
  
2986
2991
  cached_field_type= agg_field_type(agg, nagg);
2987
2992
  /*
3006
3011
      {
3007
3012
        DBUG_ASSERT((Item_result)i != ROW_RESULT);
3008
3013
        if ((Item_result)i == STRING_RESULT &&
3009
 
            agg_arg_charsets(cmp_collation, agg, nagg, MY_COLL_CMP_CONV, 1))
 
3014
            agg_arg_charsets_for_comparison(cmp_collation, agg, nagg))
3010
3015
          return;
3011
3016
        if (!(cmp_items[i]=
3012
3017
            cmp_item::get_comparator((Item_result)i,
3169
3174
  case STRING_RESULT:
3170
3175
    count_only_length();
3171
3176
    decimals= NOT_FIXED_DEC;
3172
 
    agg_arg_charsets(collation, args, arg_count, MY_COLL_ALLOW_CONV, 1);
 
3177
    agg_arg_charsets_for_string_result(collation, args, arg_count);
3173
3178
    break;
3174
3179
  case DECIMAL_RESULT:
3175
3180
    count_decimal_length();
3814
3819
  if (type_cnt == 1)
3815
3820
  {
3816
3821
    if (cmp_type == STRING_RESULT && 
3817
 
        agg_arg_charsets(cmp_collation, args, arg_count, MY_COLL_CMP_CONV, 1))
 
3822
        agg_arg_charsets_for_comparison(cmp_collation, args, arg_count))
3818
3823
      return;
3819
3824
    arg_types_compatible= TRUE;
3820
3825
  }
3992
3997
        if (found_types & (1 << i) && !cmp_items[i])
3993
3998
        {
3994
3999
          if ((Item_result)i == STRING_RESULT &&
3995
 
              agg_arg_charsets(cmp_collation, args, arg_count,
3996
 
                               MY_COLL_CMP_CONV, 1))
 
4000
              agg_arg_charsets_for_comparison(cmp_collation, args, arg_count))
3997
4001
            return;
3998
4002
          if (!cmp_items[i] && !(cmp_items[i]=
3999
4003
              cmp_item::get_comparator((Item_result)i,
4860
4864
  max_length= 1;
4861
4865
  decimals= 0;
4862
4866
 
4863
 
  if (agg_arg_charsets(cmp_collation, args, 2, MY_COLL_CMP_CONV, 1))
 
4867
  if (agg_arg_charsets_for_comparison(cmp_collation, args, 2))
4864
4868
    return TRUE;
4865
4869
 
4866
4870
  regex_lib_flags= (cmp_collation.collation->state &