From jinujosein@yahoo.com Tue Dec 16 02:41:13 2003 X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 629D6D1B447 for ; Tue, 16 Dec 2003 02:41:13 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 58821-07 for ; Mon, 15 Dec 2003 22:40:54 -0400 (AST) Received: from web14906.mail.yahoo.com (web14906.mail.yahoo.com [216.136.225.58]) by svr1.postgresql.org (Postfix) with SMTP id 3CBF1D1B567 for ; Mon, 15 Dec 2003 22:40:44 -0400 (AST) Message-ID: <20031216024053.4324.qmail@web14906.mail.yahoo.com> Received: from [61.3.241.192] by web14906.mail.yahoo.com via HTTP; Mon, 15 Dec 2003 18:40:53 PST Date: Mon, 15 Dec 2003 18:40:53 -0800 (PST) From: "George A.J" Subject: Bug correction To: pgsql-odbc@postgresql.org In-Reply-To: <3FDD8B7A.34879C61@tpf.co.jp> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1352904618-1071542453=:772" X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.7 tagged_above=0.0 required=5.0 tests=HTML_10_20, IN_REP_TO, RCVD_IN_OSIRUSOFT_COM X-Spam-Level: * X-Archive-Number: 200312/44 X-Sequence-Number: 3582 --0-1352904618-1071542453=:772 Content-Type: text/plain; charset=us-ascii hi all, i am using postgresql 7.3.2 with ODBC 7.3.1 i have fixed a bug in the ODBC driver. ie the bug when numeric input 0.009 is given it reached database as .9 . how can i add this fix to the source. the bug is still in the latest ODBC. pls inform about how can i send this fix.. regards jinujose --------------------------------- Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing --0-1352904618-1071542453=:772 Content-Type: text/html; charset=us-ascii

hi all,

i am using postgresql 7.3.2 with ODBC 7.3.1

i have fixed a bug in the ODBC driver. ie the bug when numeric input 0.009 is given it reached database as .9 . how can i add this fix to the source. the bug is still in the latest ODBC.

pls inform about how can i send this fix..

regards

jinujose 


Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing --0-1352904618-1071542453=:772-- From inoue@tpf.co.jp Fri Dec 19 15:01:28 2003 X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 83E30D1B44D for ; Fri, 19 Dec 2003 15:01:28 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 15900-05 for ; Fri, 19 Dec 2003 11:00:43 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id B22D4D1B480 for ; Fri, 19 Dec 2003 11:00:39 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id hBJF0cU6010841 for ; Fri, 19 Dec 2003 15:00:38 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id hBJEZqW5070926 for pgsql-odbc@postgresql.org; Fri, 19 Dec 2003 14:35:52 GMT From: "Hiroshi Inoue" X-Newsgroups: comp.databases.postgresql.interfaces.odbc Subject: Re: Bug correction Date: Fri, 19 Dec 2003 23:35:40 +0900 Organization: Hub.Org Networking Services Lines: 14 Message-ID: References: <3FDD8B7A.34879C61@tpf.co.jp> <20031216024053.4324.qmail@web14906.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 To: pgsql-odbc@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/64 X-Sequence-Number: 3602 Please post your patch(diff -c style) to pgsql-odbc ML. regards,, Hiroshi Inoue > ""George A.J"" wrote in message news:20031216024053.4324.qmail@web14906.mail.yahoo.com... > hi all, > i am using postgresql 7.3.2 with ODBC 7.3.1 > i have fixed a bug in the ODBC driver. ie the bug when numeric input 0.009 is given it reached database as .9 . > how can i add this fix to the source. the bug is still in the latest ODBC. > pls inform about how can i send this fix.. From Inoue@tpf.co.jp Mon Jan 5 09:34:14 2004 X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BC367D1B4D5 for ; Mon, 5 Jan 2004 09:34:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 36170-07 for ; Mon, 5 Jan 2004 05:33:26 -0400 (AST) Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by svr1.postgresql.org (Postfix) with SMTP id 98889D1B479 for ; Mon, 5 Jan 2004 05:33:23 -0400 (AST) Received: (qmail 10637 invoked from network); 5 Jan 2004 18:33:25 +0900 Received: from unknown (HELO viscomail.tpf.co.jp) (100.0.0.108) by sd2.tpf-fw-c.co.jp with SMTP; 5 Jan 2004 18:33:25 +0900 Received: from tpf.co.jp ([126.0.1.67]) by viscomail.tpf.co.jp (8.8.8+Sun/8.8.8) with ESMTP id SAA05346; Mon, 5 Jan 2004 18:33:24 +0900 (JST) Message-ID: <3FF93015.315FF61B@tpf.co.jp> Date: Mon, 05 Jan 2004 18:36:21 +0900 From: Hiroshi Inoue X-Mailer: Mozilla 4.73 [ja] (Windows NT 5.0; U) X-Accept-Language: ja MIME-Version: 1.0 To: "George A.J" Cc: pgsql-odbc@postgresql.org Subject: Re: Bug correction References: <20031231024542.24968.qmail@web14903.mail.yahoo.com> Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/7 X-Sequence-Number: 3636 "George A.J" wrote: > > Hi, > i don't know how to send a fix in the diff format so i am sending the > corected file. > i have changed the function ResolveNumericParam() in the file > convert.c > the function is given billow. i have commented the added/deleted > lines. also attaching the file convert.c. The first bug (0.0 -> .) is fixed in CVS already. I would fix the second bug (.009 -> .9) according to your code. regards, Hiroshi Inoue > static BOOL > ResolveNumericParam(const SQL_NUMERIC_STRUCT *ns, char *chrform) > { > static const int prec[] = {1, 3, 5, 8, 10, 13, 15, 17, 20, 22, 25, > 29, 32, 34, 37, 39}; > Int4 i, j, k, ival, vlen, len, newlen; > unsigned char calv[40]; > const unsigned char *val = (const unsigned char *) ns->val; > BOOL next_figure; > > if (0 == ns->precision) > { > strcpy(chrform, "0"); > return TRUE; > } > else if (ns->precision < prec[sizeof(Int4)]) > { > for (i = 0, ival = 0; i < sizeof(Int4) && prec[i] <= ns->precision; > i++) > { > ival += (val[i] << (8 * i)); /* ns->val is little endian */ > } > if (0 == ns->scale) > { > if (0 == ns->sign) > ival *= -1; > sprintf(chrform, "%d", ival); > } > else if (ns->scale > 0) > { > Int4 i, div, o1val, o2val; > > for (i = 0, div = 1; i < ns->scale; i++) > div *= 10; > o1val = ival / div; > o2val = ival % div; > if (0 == ns->sign) > o1val *= -1; > sprintf(chrform, "%d.%0.*d", o1val, ns->scale, o2val); > } > return TRUE; > } > > for (i = 0; i < SQL_MAX_NUMERIC_LEN && prec[i] <= ns->precision; i++) > ; > vlen = i; > len = 0; > memset(calv, 0, sizeof(calv)); > for (i = vlen - 1; i >= 0; i--) > { > for (j = len - 1; j >= 0; j--) > { > if (!calv[j]) > continue; > ival = (((Int4)calv[j]) << 8); > calv[j] = (ival % 10); > ival /= 10; > calv[j + 1] += (ival % 10); > ival /= 10; > calv[j + 2] += (ival % 10); > ival /= 10; > calv[j + 3] += ival; > for (k = j;; k++) > { > next_figure = FALSE; > if (calv[k] > 0) > { > if (k >= len) > len = k + 1; > while (calv[k] > 9) > { > calv[k + 1]++; > calv[k] -= 10; > next_figure = TRUE; > } > } > if (k >= j + 3 && !next_figure) > break; > } > } > ival = val[i]; > if (!ival) > continue; > calv[0] += (ival % 10); > ival /= 10; > calv[1] += (ival % 10); > ival /= 10; > calv[2] += ival; > for (j = 0;; j++) > { > next_figure = FALSE; > if (calv[j] > 0) > { > if (j >= len) > len = j + 1; > while (calv[j] > 9) > { > calv[j + 1]++; > calv[j] -= 10; > next_figure = TRUE; > } > } > if (j >= 2 && !next_figure) > break; > } > } > > /********* New code:*/ > > /*Added to fix the numeric convertion bug. > BUG:When 0.0 is the input function returns '.' Also if 0.0009 is > input > the fnction returns '.9'*/ > > if (len <= ns->scale) > len = ns->scale + 1; > > /********* End New code: */ > > newlen = 0; > if (0 == ns->sign) > chrform[newlen++] = '-'; > for (i = len - 1; i >= ns->scale; i--) > chrform[newlen++] = calv[i] + '0'; > if (ns->scale > 0) > { > chrform[newlen++] = '.'; > for (; i >= 0; i--) > chrform[newlen++] = calv[i] + '0'; > } > > /********* deleted code:*/ > > /*deleted to fix the numeric convertion bug. these lines are not > needed > if (0 == len) > chrform[newlen++] = '0';*/ > /********* end deleted code:*/ > > chrform[newlen] = '\0'; > return TRUE; > }