~ubuntu-branches/ubuntu/raring/mysql-5.5/raring-proposed

« back to all changes in this revision

Viewing changes to sql/item_cmpfunc.cc

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-02-14 23:59:22 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20120214235922-cux5uek1e5l0hje9
Tags: 5.5.20-0ubuntu1
* New upstream release.
* d/mysql-server-5.5.mysql.upstart: Fix stop on to make sure mysql is
  fully stopped before shutdown commences. (LP: #688541) Also simplify
  start on as it is redundant.
* d/control: Depend on upstart version which has apparmor profile load
  script to prevent failure on upgrade from lucid to precise.
  (LP: #907465)
* d/apparmor-profile: need to allow /run since that is the true path
  of /var/run files. (LP: #917542)
* d/control: mysql-server-5.5 has files in it that used to be owned
  by libmysqlclient-dev, so it must break/replace it. (LP: #912487)
* d/rules, d/control: 5.5.20 Fixes segfault on tests with gcc 4.6,
  change compiler back to system default.
* d/rules: Turn off embedded libedit/readline.(Closes: #659566)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2625
2625
}
2626
2626
 
2627
2627
 
 
2628
void Item_func_if::cache_type_info(Item *source)
 
2629
{
 
2630
  collation.set(source->collation);
 
2631
  cached_field_type=  source->field_type();
 
2632
  cached_result_type= source->result_type();
 
2633
  decimals=           source->decimals;
 
2634
  max_length=         source->max_length;
 
2635
  maybe_null=         source->maybe_null;
 
2636
  unsigned_flag=      source->unsigned_flag;
 
2637
}
 
2638
 
 
2639
 
2628
2640
void
2629
2641
Item_func_if::fix_length_and_dec()
2630
2642
{
2631
 
  maybe_null=args[1]->maybe_null || args[2]->maybe_null;
 
2643
  // Let IF(cond, expr, NULL) and IF(cond, NULL, expr) inherit type from expr.
 
2644
  if (args[1]->type() == NULL_ITEM)
 
2645
  {
 
2646
    cache_type_info(args[2]);
 
2647
    maybe_null= true;
 
2648
    // If both arguments are NULL, make resulting type BINARY(0).
 
2649
    if (args[2]->type() == NULL_ITEM)
 
2650
      cached_field_type= MYSQL_TYPE_STRING;
 
2651
    return;
 
2652
  }
 
2653
  if (args[2]->type() == NULL_ITEM)
 
2654
  {
 
2655
    cache_type_info(args[1]);
 
2656
    maybe_null= true;
 
2657
    return;
 
2658
  }
 
2659
 
 
2660
  agg_result_type(&cached_result_type, args + 1, 2);
 
2661
  maybe_null= args[1]->maybe_null || args[2]->maybe_null;
2632
2662
  decimals= max(args[1]->decimals, args[2]->decimals);
2633
2663
  unsigned_flag=args[1]->unsigned_flag && args[2]->unsigned_flag;
2634
2664
 
2635
 
  enum Item_result arg1_type=args[1]->result_type();
2636
 
  enum Item_result arg2_type=args[2]->result_type();
2637
 
  bool null1=args[1]->const_item() && args[1]->null_value;
2638
 
  bool null2=args[2]->const_item() && args[2]->null_value;
2639
 
 
2640
 
  if (null1)
2641
 
  {
2642
 
    cached_result_type= arg2_type;
2643
 
    collation.set(args[2]->collation);
2644
 
    cached_field_type= args[2]->field_type();
2645
 
    max_length= args[2]->max_length;
2646
 
    return;
2647
 
  }
2648
 
 
2649
 
  if (null2)
2650
 
  {
2651
 
    cached_result_type= arg1_type;
2652
 
    collation.set(args[1]->collation);
2653
 
    cached_field_type= args[1]->field_type();
2654
 
    max_length= args[1]->max_length;
2655
 
    return;
2656
 
  }
2657
 
 
2658
 
  agg_result_type(&cached_result_type, args + 1, 2);
2659
2665
  if (cached_result_type == STRING_RESULT)
2660
2666
  {
2661
2667
    if (agg_arg_charsets_for_string_result(collation, args + 1, 2))