pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ranjeeth kumar <ranjeeth_cool@yahoo.co.in>
To: pgsql-odbc@postgresql.org <pgsql-odbc@postgresql.org>
Subject: Regarding PostgreSQL BIT datatype binding in ODBC.......
Date: Thu, 2 Aug 2012 15:25:23 +0800 (SGT)
Message-ID: <1343892323.97562.YahooMailNeo@web190004.mail.sg3.yahoo.com> (raw)

Hello All,

I am new to this mailing list and this is my first post :)


I want to pass numeric data (2345) into a PostgreSQL BIT datatype column bit(1) using dynamic sql thru ODBC. I very much understand the risk of data getting truncated...
On PSQL, I simply can do -- insert into tab values(CAST(2345 AS BIT(1))) to acheive what i want (and I understand only 1 would get inserted). But I want to do this through ODBC and dynamic sql.

I will have to prepare my query as 

insert into tab values(CAST(? AS bit(1));

then bind 2345 and then execute the statement. 

Can someone help me on how the binding should happen... 
I mean wat should be the "ValueType" and the "ParameterType" etc. in the call to the SQLBindParameter function....

SQLRETURN SQLBindParameter(
      SQLHSTMT        StatementHandle,
      SQLUSMALLINT    ParameterNumber,
      SQLSMALLINT     InputOutputType,
      SQLSMALLINT     ValueType,
      SQLSMALLINT     ParameterType,
      SQLULEN         ColumnSize,
      SQLSMALLINT     DecimalDigits,
      SQLPOINTER      ParameterValuePtr,
      SQLLEN          BufferLength,
      SQLLEN *        StrLen_or_IndPtr);


Quick help is appreciated and additional inputs/coments are also most welcome...



Thanks and Regards,
Ranjeeth. =

view thread (6+ messages)  latest in thread

Message-ID: <1343892323.97562.YahooMailNeo@web190004.mail.sg3.yahoo.com>
Permalink:  ../1343892323.97562.YahooMailNeo@web190004.mail.sg3.yahoo.com/
Also on:    postgresql.org/message-id/1343892323.97562.YahooMailNeo@web190004.mail.sg3.yahoo.com

 · 

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: ranjeeth_cool@yahoo.co.in
  Subject: Re: Regarding PostgreSQL BIT datatype binding in ODBC.......
  In-Reply-To: <1343892323.97562.YahooMailNeo@web190004.mail.sg3.yahoo.com>
  References: <1343892323.97562.YahooMailNeo@web190004.mail.sg3.yahoo.com>

* 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