~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/min_max.cc

  • Committer: Lee Bieber
  • Date: 2010-12-23 23:11:00 UTC
  • mfrom: (2024.1.1 clean)
  • Revision ID: kalebral@gmail.com-20101223231100-0rqirgz7ugkl10yp
Merge Brian - session list cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
#include <drizzled/function/min_max.h>
23
23
#include <drizzled/item/cmpfunc.h>
24
 
#include <drizzled/session.h>
25
24
 
26
25
namespace drizzled
27
26
{
60
59
    }
61
60
  }
62
61
  else if ((cmp_type == DECIMAL_RESULT) || (cmp_type == INT_RESULT))
63
 
    max_length= class_decimal_precision_to_length(max_int_part+decimals, decimals,
 
62
    max_length= my_decimal_precision_to_length(max_int_part+decimals, decimals,
64
63
                                            unsigned_flag);
65
64
  cached_field_type= agg_field_type(args, arg_count);
66
65
}
152
151
 
153
152
  case DECIMAL_RESULT:
154
153
    {
155
 
      type::Decimal dec_buf, *dec_val= val_decimal(&dec_buf);
 
154
      my_decimal dec_buf, *dec_val= val_decimal(&dec_buf);
156
155
      if (null_value)
157
156
        return 0;
158
 
      class_decimal2string(dec_val, 0, str);
 
157
      my_decimal2string(E_DEC_FATAL_ERROR, dec_val, 0, 0, 0, str);
159
158
      return str;
160
159
    }
161
160
 
258
257
}
259
258
 
260
259
 
261
 
type::Decimal *Item_func_min_max::val_decimal(type::Decimal *dec)
 
260
my_decimal *Item_func_min_max::val_decimal(my_decimal *dec)
262
261
{
263
262
  assert(fixed == 1);
264
 
  type::Decimal tmp_buf, *tmp, *res= NULL;
 
263
  my_decimal tmp_buf, *tmp, *res= NULL;
265
264
 
266
265
  if (compare_as_dates)
267
266
  {
277
276
    else
278
277
    {
279
278
      tmp= args[i]->val_decimal(&tmp_buf);      // Zero if NULL
280
 
      if (tmp && (class_decimal_cmp(tmp, res) * cmp_sign) < 0)
 
279
      if (tmp && (my_decimal_cmp(tmp, res) * cmp_sign) < 0)
281
280
      {
282
281
        if (tmp == &tmp_buf)
283
282
        {
284
283
          /* Move value out of tmp_buf as this will be reused on next loop */
285
 
          class_decimal2decimal(tmp, dec);
 
284
          my_decimal2decimal(tmp, dec);
286
285
          res= dec;
287
286
        }
288
287
        else