When converting the value zero, the result is wrong: it is converted to
authorDave Page <dpage@pgadmin.org>
Wed, 18 Jun 2003 12:48:18 +0000 (12:48 +0000)
committerDave Page <dpage@pgadmin.org>
Wed, 18 Jun 2003 12:48:18 +0000 (12:48 +0000)
"" or ".", depending on the precision.
The attached patch insures a zero to be added, so this converts to "0"
or "0."
[Andreas Pflug]

convert.c

index 05e32993a4cd95b8572af4c5cae3538ad74453b5..6c720042120c9252ccf579dd8df04bb1db268cfb 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -2378,7 +2378,9 @@ ResolveNumericParam(const SQL_NUMERIC_STRUCT *ns, char *chrform)
        chrform[newlen++] = '-';
    for (i = len - 1; i >= ns->scale; i--)
        chrform[newlen++] = calv[i] + '0';
-   if (ns->scale > 0)
+    if (!newlen)
+        chrform[newlen++] = '0';
+    if (ns->scale > 0)
    {
        chrform[newlen++] = '.';
        for (; i >= 0; i--)