X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D50C5545EE for ; Tue, 1 Mar 2005 23:17:41 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30233-04 for ; Tue, 1 Mar 2005 23:17:33 +0000 (GMT) Received: from tbserver.tradebot.com (mail.tradebotsystems.com [209.83.219.42]) by svr1.postgresql.org (Postfix) with ESMTP id E03B254438 for ; Tue, 1 Mar 2005 23:17:31 +0000 (GMT) Received: from [192.168.200.29] ([192.168.200.29]) by tbserver.tradebot.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 1 Mar 2005 17:17:34 -0600 Message-ID: <4224F80D.2080103@kkcsm.net> Date: Tue, 01 Mar 2005 17:17:33 -0600 From: Kelly Burkhart User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-odbc@postgresql.org Subject: 32-bit ints on 64-bit linux Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 01 Mar 2005 23:17:34.0353 (UTC) FILETIME=[D9989810:01C51EB4] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200503/8 X-Sequence-Number: 5026 Greetings, I am having a problem in running some code in 64 bit unix. I'm running unixODBC and psqlodbc-08.00.0005 on SuSE 9.1 x86-64. If I bind a 32 bit integer using SQL_INTEGER/SQL_C_LONG and pass a value of -1, the insert fails with an 'integer out of range' error. The reason this happens is the sprintf near line 2658 of convert.c. case SQL_C_SLONG: case SQL_C_LONG: sprintf(param_string, "%ld", *((SDWORD *) buffer)); break; How should this be fixed? Should SQL_C_LONG/SQL_C_SLONG be identified with the native C long of the compiler? On Linux/GCC long is 64 bits. On Windows 64, I believe a long will remain 32 bits. It seems nicer to me to reserve SQL_C_LONG/SLONG for 32 bit ints and use SQL_C_SBIGINT/SQL_C_UBIGINT for 64 bit ints. An alternative approach would be to use: ipdopts->parameters[param_number].column_size to select an appropriate sprintf. What do you ODBC experts consider an appropriate approach. -K