pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Inoue, Hiroshi <inoue@tpf.co.jp>
To: Daniel Vogelbacher <daniel@vogelbacher.name>
Cc: pgsql-odbc@postgresql.org
Subject: Re: SQL_ERROR on SQLExecute() when using SQL_C_NUMERIC for parameters
Date: Tue, 04 Jun 2013 12:35:29 +0900
Message-ID: <51AD6081.6060503@tpf.co.jp> (raw)
In-Reply-To: <20130603184915.GA14951@pollux.home.local>
References: <20130526103853.GA31025@pollux.home.local>
	<51AC7EEC.6040101@tpf.co.jp>
	<20130603184915.GA14951@pollux.home.local>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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




-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



view thread (4+ messages)

Message-ID: <51AD6081.6060503@tpf.co.jp>
Permalink:  ../51AD6081.6060503@tpf.co.jp/
Also on:    postgresql.org/message-id/51AD6081.6060503@tpf.co.jp

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: inoue@tpf.co.jp, daniel@vogelbacher.name
  Subject: Re: SQL_ERROR on SQLExecute() when using SQL_C_NUMERIC for parameters
  In-Reply-To: <51AD6081.6060503@tpf.co.jp>
  References: <20130526103853.GA31025@pollux.home.local> <51AC7EEC.6040101@tpf.co.jp> <20130603184915.GA14951@pollux.home.local> <51AD6081.6060503@tpf.co.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox