~ubuntu-branches/ubuntu/quantal/mysql-5.5/quantal-security

« back to all changes in this revision

Viewing changes to sql/item_cmpfunc.cc

  • Committer: Package Import Robot
  • Author(s): Seth Arnold
  • Date: 2013-04-18 18:15:39 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20130418181539-7uo1w041b4h2ulbs
Tags: 5.5.31-0ubuntu0.12.10.1
* SECURITY UPDATE: Update to 5.5.31 to fix security issues (LP: #1170516)
  - http://www.oracle.com/technetwork/topics/security/cpuapr2013-1899555.html
* debian/patches/71_disable_rpl_tests.patch: refreshed.
* debian/patches/fix-mysqldump-test.patch: removed, fixed differently
  upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
 
1
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
2
2
 
3
3
   This program is free software; you can redistribute it and/or modify
4
4
   it under the terms of the GNU General Public License as published by
220
220
         items[i]->result_type() == ROW_RESULT) &&
221
221
        cmp_row_type(items[0], items[i]))
222
222
      return 0;
223
 
    found_types|= 1<< (uint)item_cmp_type(left_result,
224
 
                                           items[i]->result_type());
 
223
    found_types|= 1U << (uint)item_cmp_type(left_result,
 
224
                                            items[i]->result_type());
225
225
  }
226
226
  /*
227
227
   Even if all right-hand items are NULLs and we are skipping them all, we need
228
228
   at least one type bit in the found_type bitmask.
229
229
  */
230
230
  if (skip_nulls && !found_types)
231
 
    found_types= 1 << (uint)left_result;
 
231
    found_types= 1U << (uint)left_result;
232
232
  return found_types;
233
233
}
234
234
 
2897
2897
      cmp_type= item_cmp_type(left_result_type, args[i]->result_type());
2898
2898
      DBUG_ASSERT(cmp_type != ROW_RESULT);
2899
2899
      DBUG_ASSERT(cmp_items[(uint)cmp_type]);
2900
 
      if (!(value_added_map & (1<<(uint)cmp_type)))
 
2900
      if (!(value_added_map & (1U << (uint)cmp_type)))
2901
2901
      {
2902
2902
        cmp_items[(uint)cmp_type]->store_value(args[first_expr_num]);
2903
2903
        if ((null_value=args[first_expr_num]->null_value))
2904
2904
          return else_expr_num != -1 ? args[else_expr_num] : 0;
2905
 
        value_added_map|= 1<<(uint)cmp_type;
 
2905
        value_added_map|= 1U << (uint)cmp_type;
2906
2906
      }
2907
2907
      if (!cmp_items[(uint)cmp_type]->cmp(args[i]) && !args[i]->null_value)
2908
2908
        return args[i + 1];
3107
3107
    nagg++;
3108
3108
    if (!(found_types= collect_cmp_types(agg, nagg)))
3109
3109
      return;
3110
 
    if (found_types & (1 << STRING_RESULT))
 
3110
    if (found_types & (1U << STRING_RESULT))
3111
3111
    {
3112
3112
      /*
3113
3113
        If we'll do string comparison, we also need to aggregate
3147
3147
    }
3148
3148
    for (i= 0; i <= (uint)DECIMAL_RESULT; i++)
3149
3149
    {
3150
 
      if (found_types & (1 << i) && !cmp_items[i])
 
3150
      if (found_types & (1U << i) && !cmp_items[i])
3151
3151
      {
3152
3152
        DBUG_ASSERT((Item_result)i != ROW_RESULT);
3153
3153
        if (!(cmp_items[i]=
3956
3956
  }
3957
3957
  for (i= 0; i <= (uint)DECIMAL_RESULT; i++)
3958
3958
  {
3959
 
    if (found_types & 1 << i)
 
3959
    if (found_types & (1U << i))
3960
3960
    {
3961
3961
      (type_cnt)++;
3962
3962
      cmp_type= (Item_result) i;
4139
4139
    {
4140
4140
      for (i= 0; i <= (uint) DECIMAL_RESULT; i++)
4141
4141
      {
4142
 
        if (found_types & (1 << i) && !cmp_items[i])
 
4142
        if (found_types & (1U << i) && !cmp_items[i])
4143
4143
        {
4144
4144
          if ((Item_result)i == STRING_RESULT &&
4145
4145
              agg_arg_charsets_for_comparison(cmp_collation, args, arg_count))
4229
4229
    Item_result cmp_type= item_cmp_type(left_result_type, args[i]->result_type());
4230
4230
    in_item= cmp_items[(uint)cmp_type];
4231
4231
    DBUG_ASSERT(in_item);
4232
 
    if (!(value_added_map & (1 << (uint)cmp_type)))
 
4232
    if (!(value_added_map & (1U << (uint)cmp_type)))
4233
4233
    {
4234
4234
      in_item->store_value(args[0]);
4235
4235
      if ((null_value= args[0]->null_value))
4236
4236
        return 0;
4237
 
      value_added_map|= 1 << (uint)cmp_type;
 
4237
      value_added_map|= 1U << (uint)cmp_type;
4238
4238
    }
4239
4239
    if (!in_item->cmp(args[i]) && !args[i]->null_value)
4240
4240
      return (longlong) (!negated);
4366
4366
      const_item_cache= FALSE;
4367
4367
    }  
4368
4368
    with_sum_func=          with_sum_func || item->with_sum_func;
4369
 
    with_subselect|=        item->with_subselect;
 
4369
    with_subselect|=        item->has_subquery();
4370
4370
    if (item->maybe_null)
4371
4371
      maybe_null=1;
4372
4372
  }
4691
4691
    Handle optimization if the argument can't be null
4692
4692
    This has to be here because of the test in update_used_tables().
4693
4693
  */
4694
 
  if (!used_tables_cache && !with_subselect)
 
4694
  if (const_item_cache)
4695
4695
    return cached_value;
4696
4696
  return args[0]->is_null() ? 1: 0;
4697
4697
}
4986
4986
       args[1]->fix_fields(thd, args + 1)) || args[1]->check_cols(1))
4987
4987
    return TRUE;                                /* purecov: inspected */
4988
4988
  with_sum_func=args[0]->with_sum_func || args[1]->with_sum_func;
 
4989
  with_subselect= args[0]->has_subquery() || args[1]->has_subquery();
4989
4990
  max_length= 1;
4990
4991
  decimals= 0;
4991
4992