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 DF5D3D1B4B2 for ; Fri, 19 Dec 2003 14:42:41 +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 10637-07 for ; Fri, 19 Dec 2003 10:41:55 -0400 (AST) Received: from sd.tpf.co.jp (mail.tpf.co.jp [210.161.239.34]) by svr1.postgresql.org (Postfix) with SMTP id A644ED1B481 for ; Fri, 19 Dec 2003 10:41:46 -0400 (AST) Received: (qmail 32766 invoked from network); 19 Dec 2003 23:41:50 +0900 X-Authentication: inoue was authenticated by mail.tpf.co.jp at 19 Dec 2003 23:41:50 +0900 Received: from unknown (HELO PbgX) (219.61.40.61) by mail.tpf.co.jp with SMTP; 19 Dec 2003 23:41:50 +0900 From: "Hiroshi Inoue" To: "'Ruud Overeem'" Cc: "'Ger van Diepen'" , "'Marcel Loose'" , Subject: Re: Conversion problem with unsigned long in psqlodbc-7.3.2 Date: Fri, 19 Dec 2003 23:41:51 +0900 Message-ID: <001601c3c63e$3d465f80$3d283ddb@PbgX> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/63 X-Sequence-Number: 3601 > -----Original Message----- > From: Ruud Overeem > > Hi, > > We just installed version 7.3.2 of the postgres ODBC driver > on a RedHat > 9.0 system. When testing the limits all the variable-types it appeared > that unsigned long values are stored correct in the database > but we they > are read back we hit the LONG_MAX range. > > E.g. assign the value 2345678901 to an unsigned long, write > that to the > database and read it back. The database contains 2345678901 but the > unsigned long variable is set to LONG_MAX (2147483647). > > Digging into the sources I think I found the problem. In convert.c at > line 1184 the code says: > case SQL_C_ULONG: > len = 4; > if (bind_size > 0) > *((UDWORD *) rgbValueBindRow) = atol(neut_str); > else > *((UDWORD *) rgbValue + bind_row) = atol(neut_str); > break; > > The function atol only works for signed long integers. When > you replace > 'atol(neut_str)' with 'strtoul(neut_str, 0 , 10)' it works fine. I would take care of it. Thanks. Hiroshi Inoue