~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item.cc

  • Committer: Nathan Williams
  • Date: 2009-07-02 06:54:37 UTC
  • mfrom: (1085 staging)
  • mto: This revision was merged to the branch mainline in revision 1087.
  • Revision ID: nathanlws@gmail.com-20090702065437-nmgxvuk837rpa3e0
Merged trunk, resolved conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
#include "drizzled/field/varstring.h"
48
48
 
49
49
#include <math.h>
 
50
#include <algorithm>
 
51
 
 
52
using namespace std;
50
53
 
51
54
const String my_null_string("NULL", 4, default_charset_info);
52
55
 
316
319
  Item_result restype= result_type();
317
320
 
318
321
  if ((restype == DECIMAL_RESULT) || (restype == INT_RESULT))
319
 
    return cmin(my_decimal_length_to_precision(max_length, decimals, unsigned_flag),
 
322
    return min(my_decimal_length_to_precision(max_length, decimals, unsigned_flag),
320
323
               (uint32_t) DECIMAL_MAX_PRECISION);
321
 
  return cmin(max_length, (uint32_t) DECIMAL_MAX_PRECISION);
 
324
  return min(max_length, (uint32_t) DECIMAL_MAX_PRECISION);
322
325
}
323
326
 
324
327
int Item::decimal_int_part() const
1558
1561
    {
1559
1562
      signed int overflow;
1560
1563
 
1561
 
      dec= cmin(dec, (uint8_t)DECIMAL_MAX_SCALE);
 
1564
      dec= min(dec, (uint8_t)DECIMAL_MAX_SCALE);
1562
1565
 
1563
1566
      /*
1564
1567
        If the value still overflows the field with the corrected dec,
1571
1574
                                               item->unsigned_flag) - len;
1572
1575
 
1573
1576
      if (overflow > 0)
1574
 
        dec= cmax(0, dec - overflow);            // too long, discard fract
 
1577
        dec= max(0, dec - overflow);            // too long, discard fract
1575
1578
      else
1576
 
        len -= item->decimals - dec;            // corrected value fits
 
1579
        len-= item->decimals - dec;             // corrected value fits
1577
1580
    }
1578
1581
 
1579
1582
    new_field= new Field_new_decimal(len, maybe_null, item->name,