summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-05-11 20:56:22 +0500
committerunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-05-11 20:56:22 +0500
commit8bbe6f23db9e4c2bc4e4240751caf62588ab4f50 (patch)
tree3513d393c844e574dd5870f2d71444e6a3456124 /sql
parent78ed69c339965238c9047d0e41db6996c5a27d01 (diff)
downloadmariadb-git-8bbe6f23db9e4c2bc4e4240751caf62588ab4f50.tar.gz
merging fixes
mysql-test/r/type_datetime.result: result fixed mysql-test/t/type_datetime.test: testcase fixed sql/item_func.cc: my_decimal_length_to_precision used sql/my_decimal.h: merging fix
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc9
-rw-r--r--sql/my_decimal.h1
2 files changed, 7 insertions, 3 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 7659494f624..c0a9647e382 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1051,6 +1051,8 @@ my_decimal *Item_decimal_typecast::val_decimal(my_decimal *dec)
{
my_decimal tmp_buf, *tmp= args[0]->val_decimal(&tmp_buf);
bool sign;
+ uint precision;
+
if ((null_value= args[0]->null_value))
return NULL;
my_decimal_round(E_DEC_FATAL_ERROR, tmp, decimals, FALSE, dec);
@@ -1063,9 +1065,11 @@ my_decimal *Item_decimal_typecast::val_decimal(my_decimal *dec)
goto err;
}
}
- if (max_length - 2 - decimals < (uint) my_decimal_intg(dec))
+ precision= my_decimal_length_to_precision(max_length,
+ decimals, unsigned_flag);
+ if (precision - decimals < (uint) my_decimal_intg(dec))
{
- max_my_decimal(dec, max_length - 2, decimals);
+ max_my_decimal(dec, precision, decimals);
dec->sign(sign);
goto err;
}
@@ -1084,7 +1088,6 @@ void Item_decimal_typecast::print(String *str)
{
char len_buf[20*3 + 1];
char *end;
- CHARSET_INFO *cs= str->charset();
uint precision= my_decimal_length_to_precision(max_length, decimals,
unsigned_flag);
diff --git a/sql/my_decimal.h b/sql/my_decimal.h
index b19d6e40cb4..9558b00f0cf 100644
--- a/sql/my_decimal.h
+++ b/sql/my_decimal.h
@@ -395,6 +395,7 @@ int my_decimal_intg(const my_decimal *a)
}
+inline
void my_decimal_trim(ulong *precision, uint *scale)
{
if (!(*precision) && !(*scale))