Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UjZq3-00052F-5X for pgsql-odbc@arkaria.postgresql.org; Mon, 03 Jun 2013 18:50:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UjZq2-0003JB-DI for pgsql-odbc@arkaria.postgresql.org; Mon, 03 Jun 2013 18:50:38 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UjZq1-0003Ix-SC for pgsql-odbc@postgresql.org; Mon, 03 Jun 2013 18:50:38 +0000 Received: from basicbox3.server-home.net ([195.137.212.25]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UjZpu-00009N-1B for pgsql-odbc@postgresql.org; Mon, 03 Jun 2013 18:50:36 +0000 Received: from localhost (HSI-KBW-091-089-031-108.hsi2.kabelbw.de [91.89.31.108]) by basicbox3.server-home.net (Postfix) with ESMTPA id 9A6D41A2098B for ; Mon, 3 Jun 2013 20:50:27 +0200 (CEST) Date: Mon, 3 Jun 2013 20:49:15 +0200 From: Daniel Vogelbacher To: pgsql-odbc@postgresql.org Subject: Re: SQL_ERROR on SQLExecute() when using SQL_C_NUMERIC for parameters Message-ID: <20130603184915.GA14951@pollux.home.local> References: <20130526103853.GA31025@pollux.home.local> <51AC7EEC.6040101@tpf.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <51AC7EEC.6040101@tpf.co.jp> User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: 0.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 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 :-) > regards, > Hiroshi Inoue > > > The used statement was: > > > > INSERT INTO numtest(num1) VALUES(?); > > > > where num1 is of type NUMERIC(5,3) > > > > The driver was built from source psqlodbc-09.01.0200.tar.gz for > > unixODBC. > > > > > > Here is the odbctrace for the specific part: > > > > > > [ODBC][27210][1369515859.324218][SQLBindParameter.c][217] > > Entry: > > Statement = 0x1a908b0 > > Param Number = 1 > > Param Type = 1 > > C Type = 2 SQL_C_NUMERIC > > SQL Type = 2 SQL_NUMERIC > > Col Def = 5 > > Scale = 3 > > Rgb Value = 0x1a91210 > > Value Max = 0 > > StrLen Or Ind = 0x1a91230 > > [ODBC][27210][1369515859.324329][SQLBindParameter.c][397] > > Exit:[SQL_SUCCESS] > > [ODBC][27210][1369515859.324359][SQLSetDescFieldW.c][168] > > Entry: > > Descriptor = 0x1ab2ef0 > > Rec Number = 1 > > Field Ident = SQL_DESC_PRECISION > > Value = 0x5 > > Buffer Length = -8 > > [ODBC][27210][1369515859.324402][SQLSetDescFieldW.c][246] > > Exit:[SQL_SUCCESS] > > [ODBC][27210][1369515859.324421][SQLSetDescFieldW.c][168] > > Entry: > > Descriptor = 0x1ab2ef0 > > Rec Number = 1 > > Field Ident = SQL_DESC_SCALE > > Value = 0x3 > > Buffer Length = -8 > > [ODBC][27210][1369515859.324452][SQLSetDescFieldW.c][246] > > Exit:[SQL_SUCCESS] > > [ODBC][27210][1369515859.324480][SQLExecute.c][187] > > Entry: > > Statement = 0x1a908b0 > > [ODBC][27210][1369515859.328804][SQLExecute.c][348] > > Exit:[SQL_ERROR] > > DIAG [42601] FEHLER: Syntaxfehler bei ); > > Error while executing the query > > > > -- > Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-odbc > -- Daniel Vogelbacher www.chaospixel.com cytrinox@freenode/ircnet/quakenet -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc