Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Ws1nu-0000kp-Nq for pgsql-odbc@arkaria.postgresql.org; Wed, 04 Jun 2014 03:23:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Ws1nu-0005K4-3U for pgsql-odbc@arkaria.postgresql.org; Wed, 04 Jun 2014 03:23:54 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Ws1ns-0005Jr-4H for pgsql-odbc@postgresql.org; Wed, 04 Jun 2014 03:23:52 +0000 Received: from sd.tpf.co.jp ([210.161.239.34]) by makus.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Ws1nj-0000rr-Fn for pgsql-odbc@postgresql.org; Wed, 04 Jun 2014 03:23:50 +0000 Received: (qmail 9984 invoked by uid 512); 4 Jun 2014 03:23:40 -0000 X-Authentication: inoue was authenticated by sd.tpf.co.jp at 4 Jun 2014 03:23:40 -0000 Received: from unknown (HELO ?100.0.33.224?) (114.160.219.229) by sd.tpf.co.jp with SMTP; 4 Jun 2014 03:23:40 -0000 Message-ID: <538E9137.1000308@tpf.co.jp> Date: Wed, 04 Jun 2014 12:23:35 +0900 From: Hiroshi Inoue User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Walter Couto , "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 References: <7FA4F9E5512F214C801E596ECD8790E066A79839@ETNAMAIL01.embarcadero.com>, <538D44EC.10201@tpf.co.jp> In-Reply-To: Content-Type: multipart/mixed; boundary="------------040602050808090109040600" X-Pg-Spam-Score: -1.8 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org This is a multi-part message in MIME format. --------------040602050808090109040600 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit (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 --------------040602050808090109040600 Content-Type: text/x-patch; name="numeric_value_38_0.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="numeric_value_38_0.patch" diff --git a/convert.c b/convert.c index 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 */ --------------040602050808090109040600 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc --------------040602050808090109040600--