Re: ODBC : SQLGetData question

From: aihtdikh <aihtdikh(at)gmail(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Re: ODBC : SQLGetData question
Date: 2014-05-14 06:40:59
Message-ID: 53730FFB.5020304@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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..

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Dev Kumkar 2014-05-14 07:21:44 Re: ODBC : SQLGetData question
Previous Message Dev Kumkar 2014-05-14 05:23:18 ODBC : SQLGetData question