Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Uji2E-0006UW-BC for pgsql-odbc@arkaria.postgresql.org; Tue, 04 Jun 2013 03:35:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Uji2D-0007ME-PO for pgsql-odbc@arkaria.postgresql.org; Tue, 04 Jun 2013 03:35:45 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Uji2C-0007M8-Tr for pgsql-odbc@postgresql.org; Tue, 04 Jun 2013 03:35:45 +0000 Received: from sd.tpf.co.jp ([210.161.239.34]) by makus.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Uji21-0000rw-WF for pgsql-odbc@postgresql.org; Tue, 04 Jun 2013 03:35:44 +0000 Received: (qmail 15514 invoked by uid 512); 4 Jun 2013 03:35:31 -0000 Received: from unknown (HELO ?127.0.0.1?) (100.126.1.62) by sd2.tpf-fw-c.co.jp with SMTP; 4 Jun 2013 03:35:31 -0000 Message-ID: <51AD6081.6060503@tpf.co.jp> Date: Tue, 04 Jun 2013 12:35:29 +0900 From: "Inoue, Hiroshi" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Daniel Vogelbacher CC: pgsql-odbc@postgresql.org Subject: Re: SQL_ERROR on SQLExecute() when using SQL_C_NUMERIC for parameters References: <20130526103853.GA31025@pollux.home.local> <51AC7EEC.6040101@tpf.co.jp> <20130603184915.GA14951@pollux.home.local> In-Reply-To: <20130603184915.GA14951@pollux.home.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 0.3 (/) 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 (2013/06/04 3:49), Daniel Vogelbacher wrote: > On [Mon, 03.06.2013 20:33], Hiroshi Inoue wrote: >> Sorry for the late reply. >> >> (2013/05/26 19:38), Daniel Vogelbacher wrote: >>> Hi, >>> >>> when using SQLBindParameter with SQL_C_NUMERIC input, the function >>> returns SQL_SUCCESS. But a call to SQLExecute() returns SQL_ERROR with >>> "Syntax error on )". >>> >>> It seems that the psqlodbc driver did not replace the ? marker >>> properly and an invalid statement is passed to the server. This only >>> happens with SQL_C_NUMERIC, for other datatypes the marker gets >>> replaced. >> >> SQLSetDescField() causes the problem. >> SQLBindParameter() sets SQL_DESC_DATA_PTR field but subsequent >> SQLSetDescField() calls make the record unbound. > > > Ahh, many thanks for the hint. > Curious that the same code works fine with TDS and Firebird ODBC drivers :-) There are some differences among odbc drivers about the handling of SQL_C_NUMERIC data. Please note that psqlodbc driver ignores the precision or scale specified in SQLSetDescField() calls. Please set the precision and scale of SQL_NUMERIC_STRUCT data itself. Anyway please add the following statement to rebind the data. SQLSetDescField(hdesc, 1, SQL_DESC_DATA_PTR, ..); 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-odbc