(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