Re: SQL_ERROR on SQLExecute() when using SQL_C_NUMERIC for parameters - Mailing list pgsql-odbc
From | Daniel Vogelbacher |
---|---|
Subject | Re: SQL_ERROR on SQLExecute() when using SQL_C_NUMERIC for parameters |
Date | |
Msg-id | 20130603184915.GA14951@pollux.home.local Whole thread Raw |
In response to | Re: SQL_ERROR on SQLExecute() when using SQL_C_NUMERIC for parameters (Hiroshi Inoue <inoue@tpf.co.jp>) |
Responses |
Re: SQL_ERROR on SQLExecute() when using SQL_C_NUMERIC for
parameters
|
List | pgsql-odbc |
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 <BB>)<AB>; > > 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
pgsql-odbc by date: