pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: aihtdikh <aihtdikh@gmail.com>
To: pgsql-odbc@postgresql.org
Subject: Re: ODBC : SQLGetData question
Date: Wed, 14 May 2014 14:40:59 +0800
Message-ID: <53730FFB.5020304@gmail.com> (raw)
In-Reply-To: <CALSLE1P5zWBBckGQaOKQzcN-jkR_nn5PSno_b-iRS6cR4H=uvA@mail.gmail.com>
References: <CALSLE1P5zWBBckGQaOKQzcN-jkR_nn5PSno_b-iRS6cR4H=uvA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

Hi,

SQLGetData expects the buffer length parameter to be a SQLLEN variable, 
which is a signed type.
SQL_NULL_DATA is defined as -1, which is 4294967295 if you interpret it 
as an unsigned type.

Your my_buff_len variable is being set to SQL_NULL_DATA correctly, but 
you are looking at it wrong.
Change it to be the correct type, and it will work as you expect.

Regards,
Harun


On 14/05/14 13:23, Dev Kumkar wrote:
> Hi,
>
> I have a question regarding ODBC call SQLGetData.
>
> SQLGetData(my_stmt, my_col_no, SQL_C_CHAR, &my_max_len, 0, &my_buff_len)
>
> In case the column value is 'PG' then the value of my_buff_length gets 
> populated as 2 which is the expected value but in the call above in 
> case the table's column has value NULL then value of my_buff_len gets 
> populated as 4294967295 which is 4GB,
> instead shouldn't my_buff_len get populated as SQL_NULL_DATA?
>
> Postgres ODBC Driver version - 9.2.1
> Platform - RHEL 5
>
> Regards..



-- 
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 (10+ messages)  latest in thread

Message-ID: <53730FFB.5020304@gmail.com>
Permalink:  ../53730FFB.5020304@gmail.com/
Also on:    postgresql.org/message-id/53730FFB.5020304@gmail.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: aihtdikh@gmail.com
  Subject: Re: ODBC : SQLGetData question
  In-Reply-To: <53730FFB.5020304@gmail.com>
  References: <CALSLE1P5zWBBckGQaOKQzcN-jkR_nn5PSno_b-iRS6cR4H=uvA@mail.gmail.com> <53730FFB.5020304@gmail.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