summaryrefslogtreecommitdiff
path: root/strings/decimal.c
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2011-08-29 11:34:48 +0200
committerTor Didriksen <tor.didriksen@oracle.com>2011-08-29 11:34:48 +0200
commit3a493ae70f83d7d8549f08c950fe4ce69369a14d (patch)
treee83e044e0ae095cd37726515b006e10283d1cc36 /strings/decimal.c
parent972aeb03742c025eb0b947ce5917ed21c24c9d7f (diff)
parentf610c5658748ae97a5e2c1e1afbd229f2121a082 (diff)
downloadmariadb-git-3a493ae70f83d7d8549f08c950fe4ce69369a14d.tar.gz
merge 5.1 => 5.5
Diffstat (limited to 'strings/decimal.c')
-rw-r--r--strings/decimal.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/strings/decimal.c b/strings/decimal.c
index b18a8c3fa50..954b04ea446 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1403,11 +1403,18 @@ int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale)
buf++;
}
my_afree(d_copy);
+
+ /*
+ No digits? We have read the number zero, of unspecified precision.
+ Make it a proper zero, with non-zero precision.
+ */
+ if (to->intg == 0 && to->frac == 0)
+ decimal_make_zero(to);
return error;
err:
my_afree(d_copy);
- decimal_make_zero(((decimal_t*) to));
+ decimal_make_zero(to);
return(E_DEC_BAD_NUM);
}