summaryrefslogtreecommitdiff
path: root/strings/decimal.c
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2005-07-29 14:39:11 +0500
committerunknown <hf@deer.(none)>2005-07-29 14:39:11 +0500
commit68cd99bd9966a4738feb0fa55fd3b71a52d3c1a9 (patch)
tree459f5b5814d50b6a5a57f71564693351e7cf5387 /strings/decimal.c
parent90b2daa7133cfab02017ff9ffc44d5e8089c0c31 (diff)
downloadmariadb-git-68cd99bd9966a4738feb0fa55fd3b71a52d3c1a9.tar.gz
Fix for bug #12173 (show create table crash)
mysql-test/r/type_newdecimal.result: test result fixed mysql-test/t/type_newdecimal.test: testcase strings/decimal.c: we always add one int-part digit even if decimal(10,10) (no int part declared)
Diffstat (limited to 'strings/decimal.c')
-rw-r--r--strings/decimal.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/strings/decimal.c b/strings/decimal.c
index ca92ace92e1..4dc5fa91e0a 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -351,7 +351,8 @@ int decimal2string(decimal_t *from, char *to, int *to_len,
buf0=&tmp;
}
- intg_len= fixed_precision ? fixed_intg : (intg ? intg : 1);
+ if (!(intg_len= fixed_precision ? fixed_intg : intg))
+ intg_len= 1;
frac_len= fixed_precision ? fixed_decimals : frac;
len= from->sign + intg_len + test(frac) + frac_len;
if (fixed_precision)