Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkUc1-0006T6-Sw for pgsql-odbc@arkaria.postgresql.org; Wed, 14 May 2014 08:32:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WkUc1-0004me-4X for pgsql-odbc@arkaria.postgresql.org; Wed, 14 May 2014 08:32:29 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkUc0-0004mX-5s for pgsql-odbc@postgresql.org; Wed, 14 May 2014 08:32:28 +0000 Received: from mail.lurcherlink.org ([217.34.199.121] helo=mail.lurcher.org) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkUbv-0002d4-Ub for pgsql-odbc@postgresql.org; Wed, 14 May 2014 08:32:27 +0000 Received: from [172.20.0.153] (hul.easysoft.local [172.20.0.153]) by mail.lurcher.org (8.14.3/8.12.8) with ESMTP id s4E8W9hg008027 for ; Wed, 14 May 2014 09:32:10 +0100 Message-ID: <53732A14.1000001@lurcher.org> Date: Wed, 14 May 2014 09:32:20 +0100 From: Nick Gorham User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: pgsql-odbc@postgresql.org Subject: Re: ODBC : SQLGetData question References: <53730FFB.5020304@gmail.com> In-Reply-To: Content-Type: multipart/alternative; boundary="------------000705010903020501010902" X-Spam-Status: No, score=-3.1 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, HTML_MESSAGE autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sipserver.lurcher.org X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org This is a multi-part message in MIME format. --------------000705010903020501010902 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 14/05/14 08:46, Dev Kumkar wrote: > On Wed, May 14, 2014 at 12:51 PM, Dev Kumkar > wrote: > > On Wed, May 14, 2014 at 12:10 PM, aihtdikh > wrote: > > 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 > > > Thanks for the reply. > > my_buff_len is defined as SQLLEN > SQLLEN my_buff_len; > > > SQLGetData(my_stmt, my_col_no, SQL_C_CHAR, &my_max_len, 0, > &my_buff_len) > > if (my_buff_len == SQL_NULL_DATA) > { > // Doesn't come here > } > > What is being missed above? > > Regards... > > > if ((int)my_buff_len == SQL_NULL_DATA) > { > // will come here > } > > The above casting solves the problem, please review? > > Regards... Just to suggest. I would guess the application expects sizeof( SQLLEN ) == 8 and the driver sizeof( SQLLEN ) == 4 -- Nick Gorham --------------000705010903020501010902 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 14/05/14 08:46, Dev Kumkar wrote:
On Wed, May 14, 2014 at 12:51 PM, Dev Kumkar <devdas.kumkar@gmail.com> wrote:
On Wed, May 14, 2014 at 12:10 PM, aihtdikh <aihtdikh@gmail.com> wrote:
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

Thanks for the reply.

my_buff_len is defined as SQLLEN
      SQLLEN  my_buff_len;


      SQLGetData(my_stmt, my_col_no, SQL_C_CHAR, &my_max_len, 0, &my_buff_len)

       if (my_buff_len == SQL_NULL_DATA)
       {
            // Doesn't come here
       }

What is being missed above?

Regards...

if ((int)my_buff_len == SQL_NULL_DATA)
       {
            // will come here
       }

The above casting solves the problem, please review?

Regards...

Just to suggest.

I would guess the application expects sizeof( SQLLEN ) == 8 and the driver sizeof( SQLLEN ) == 4

--
Nick Gorham

--------------000705010903020501010902--