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



-- 
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)  latest in thread

Message-ID: <20130603184915.GA14951@pollux.home.local>
Permalink:  ../20130603184915.GA14951@pollux.home.local/
Also on:    postgresql.org/message-id/20130603184915.GA14951@pollux.home.local

 · 

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: daniel@vogelbacher.name
  Subject: Re: SQL_ERROR on SQLExecute() when using SQL_C_NUMERIC for parameters
  In-Reply-To: <20130603184915.GA14951@pollux.home.local>
  References: <20130526103853.GA31025@pollux.home.local> <51AC7EEC.6040101@tpf.co.jp> <20130603184915.GA14951@pollux.home.local>

* 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