Re: SQL_ERROR on SQLExecute() when using SQL_C_NUMERIC for parameters - Mailing list pgsql-odbc

From Inoue, Hiroshi
Subject Re: SQL_ERROR on SQLExecute() when using SQL_C_NUMERIC for parameters
Date
Msg-id 51AD6081.6060503@tpf.co.jp
Whole thread Raw
In response to Re: SQL_ERROR on SQLExecute() when using SQL_C_NUMERIC for parameters  (Daniel Vogelbacher <daniel@vogelbacher.name>)
List pgsql-odbc
(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




pgsql-odbc by date:

Previous
From: Daniel Vogelbacher
Date:
Subject: Re: SQL_ERROR on SQLExecute() when using SQL_C_NUMERIC for parameters
Next
From: "Inoue, Hiroshi"
Date:
Subject: Re: Segmentation Fault in Postgres server when using psqlODBC