From: Hiroshi Inoue <inoue@tpf.co.jp>
To: Walter Couto <Walter.Couto@EMBARCADERO.COM>
To: pgsql-odbc@postgresql.org <pgsql-odbc@postgresql.org>
Subject: Re: Problem retrieving a numeric(38,0) value as SQL_NUMERIC_STRUCT if value needs to use all 16 SQLCHAR elements of the val array
Date: Wed, 04 Jun 2014 12:23:35 +0900
Message-ID: <538E9137.1000308@tpf.co.jp> (raw)
In-Reply-To: <j0tthniykd2l143alwlicnex.1401792898107@email.android.com>
References: <7FA4F9E5512F214C801E596ECD8790E066A79839@ETNAMAIL01.embarcadero.com>
<538D44EC.10201@tpf.co.jp>
<j0tthniykd2l143alwlicnex.1401792898107@email.android.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>
(2014/06/03 19:56), Walter Couto wrote:
> Yes I can
Thanks.
Please try the attached patch.
regards,
Hiroshi Inoue
> -------- Original message --------
> From: "Inoue, Hiroshi"
> Date:06/02/2014 11:47 PM (GMT-05:00)
> To: Walter Couto ,pgsql-odbc@postgresql.org
> Subject: Re: [ODBC] Problem retrieving a numeric(38,0) value as
> SQL_NUMERIC_STRUCT if value needs to use all 16 SQLCHAR elements of the
> val array
>
> Hi Walter,
>
> Could you test a patch if I send it to you?
>
> regards,
> Hiroshi Inoue
--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbcAttachments:numeric_value_38_0.patch (text/x-patch, 1.0K) downloaddiff --git a/convert.c b/convert.cindex 1fef061..ee08876 100644--- a/convert.c+++ b/convert.c@@ -1633,6 +1633,17 @@ inolog("2stime fr=%d\n", std_time.fr);
break;
else
{
+ if (nlen >= sizeof(calv))+ {+ if (dot_exist)+ break;+ else+ {+ ns->scale--;+ result = COPY_RESULT_TRUNCATED;+ continue;+ }+ }
if (dot_exist)
ns->scale++;
ns->precision++;
@@ -1658,15 +1669,22 @@ inolog("2stime fr=%d\n", std_time.fr);
ns->val[olen++] = hval;
hval = 0;
bit = 1L;
- if (olen >= SQL_MAX_NUMERIC_LEN - 1)+ if (olen >= SQL_MAX_NUMERIC_LEN)
{
- ns->scale = sta - ns->precision;+ if (sta < nlen)+ result = COPY_RESULT_TRUNCATED;
break;
}
}
}
- if (hval && olen < SQL_MAX_NUMERIC_LEN - 1)- ns->val[olen++] = hval;+ if (hval)+ {+ if (olen >= SQL_MAX_NUMERIC_LEN)+ result = COPY_RESULT_TRUNCATED;+ else+ ns->val[olen++] = hval;+ }+
}
break;
#endif /* ODBCVER */
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: inoue@tpf.co.jp, Walter.Couto@EMBARCADERO.COM
Subject: Re: Problem retrieving a numeric(38,0) value as SQL_NUMERIC_STRUCT if value needs to use all 16 SQLCHAR elements of the val array
In-Reply-To: <538E9137.1000308@tpf.co.jp>
References: <7FA4F9E5512F214C801E596ECD8790E066A79839@ETNAMAIL01.embarcadero.com> <538D44EC.10201@tpf.co.jp> <j0tthniykd2l143alwlicnex.1401792898107@email.android.com> <538E9137.1000308@tpf.co.jp>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox