Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UjT0s-0001n0-TW for pgsql-odbc@arkaria.postgresql.org; Mon, 03 Jun 2013 11:33:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UjT0s-0001uq-92 for pgsql-odbc@arkaria.postgresql.org; Mon, 03 Jun 2013 11:33:22 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UjT0q-0001ui-Eh for pgsql-odbc@postgresql.org; Mon, 03 Jun 2013 11:33:20 +0000 Received: from sd.tpf.co.jp ([210.161.239.34]) by makus.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1UjT0i-0000Gw-Tt for pgsql-odbc@postgresql.org; Mon, 03 Jun 2013 11:33:19 +0000 Received: (qmail 29428 invoked by uid 512); 3 Jun 2013 11:33:10 -0000 X-Authentication: inoue was authenticated by sd.tpf.co.jp at 3 Jun 2013 11:33:10 -0000 Received: from unknown (HELO ?192.168.1.3?) (110.5.25.94) by sd.tpf.co.jp with SMTP; 3 Jun 2013 11:33:10 -0000 Message-ID: <51AC7EEC.6040101@tpf.co.jp> Date: Mon, 03 Jun 2013 20:33:00 +0900 From: Hiroshi Inoue User-Agent: Mozilla/5.0 (Windows NT 6.0; 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> In-Reply-To: <20130526103853.GA31025@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 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. 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