Regarding PostgreSQL BIT datatype binding in ODBC.......

From: ranjeeth kumar <ranjeeth_cool(at)yahoo(dot)co(dot)in>
To: "pgsql-odbc(at)postgresql(dot)org" <pgsql-odbc(at)postgresql(dot)org>
Subject: Regarding PostgreSQL BIT datatype binding in ODBC.......
Date: 2012-08-02 07:25:23
Message-ID: 1343892323.97562.YahooMailNeo@web190004.mail.sg3.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

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. 

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Josef Springer 2012-08-03 07:18:21 Problem with ODBC-Driver on a Windows 7/x 64
Previous Message Lionel Elie Mamane 2012-07-23 14:21:17 Re: segfault in SQLSpecialColumns when table name is null string