summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorunknown <sanja@askmonty.org>2010-02-01 08:14:12 +0200
committerunknown <sanja@askmonty.org>2010-02-01 08:14:12 +0200
commite5099a2c85468d01d084b1071f724bc20766271d (patch)
tree50e180dfcaa058cefb382d2ab931592cddbd007d /sql/item_func.cc
parentf83113df07d6ef8e8a6d1db8f6dc3bb90fb0652a (diff)
parente9bce6c9d4bde35306b845e22e9b5ada69c4512f (diff)
downloadmariadb-git-e5099a2c85468d01d084b1071f724bc20766271d.tar.gz
merge 5.1->5.2
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc39
1 files changed, 1 insertions, 38 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 7dbf07ab86f..b4c27a601d5 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -450,45 +450,8 @@ Field *Item_func::tmp_table_field(TABLE *table)
case STRING_RESULT:
return make_string_field(table);
case DECIMAL_RESULT:
- {
- uint8 dec= decimals;
- uint8 intg= decimal_precision() - dec;
- uint32 len= max_length;
-
- /*
- Trying to put too many digits overall in a DECIMAL(prec,dec)
- will always throw a warning. We must limit dec to
- DECIMAL_MAX_SCALE however to prevent an assert() later.
- */
-
- if (dec > 0)
- {
- int overflow;
-
- dec= min(dec, DECIMAL_MAX_SCALE);
-
- /*
- If the value still overflows the field with the corrected dec,
- we'll throw out decimals rather than integers. This is still
- bad and of course throws a truncation warning.
- */
-
- const int required_length=
- my_decimal_precision_to_length(intg + dec, dec,
- unsigned_flag);
-
- overflow= required_length - len;
-
- if (overflow > 0)
- dec= max(0, dec - overflow); // too long, discard fract
- else
- /* Corrected value fits. */
- len= required_length;
- }
-
- field= new Field_new_decimal(len, maybe_null, name, dec, unsigned_flag);
+ field= Field_new_decimal::create_from_item(this);
break;
- }
case ROW_RESULT:
default:
// This case should never be chosen