Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkTu4-0004nD-LA for pgsql-odbc@arkaria.postgresql.org; Wed, 14 May 2014 07:47:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WkTu4-0000XW-4X for pgsql-odbc@arkaria.postgresql.org; Wed, 14 May 2014 07:47:04 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkTu3-0000XP-HF for pgsql-odbc@postgresql.org; Wed, 14 May 2014 07:47:03 +0000 Received: from mail-we0-x235.google.com ([2a00:1450:400c:c03::235]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkTu0-0001re-US for pgsql-odbc@postgresql.org; Wed, 14 May 2014 07:47:02 +0000 Received: by mail-we0-f181.google.com with SMTP id w61so1477502wes.40 for ; Wed, 14 May 2014 00:46:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=rz1vrOLtJiy4Ywl5st2VzbEP9GnvNVa8/7GF5Rxp74k=; b=ijPgE9BMehgl0nGlbluDmfYTbQoKcG+CcyuNJi2XxW0AgodtYkuD68jtOGkDE9ROOk QkgWXS2201B5llJneRmkcpQdOICwiGInKw6b+urCey8G1rFTF4VaSLz9rBoeaJt4PlZz KX5C0VSba7eTA0EpEdMtoRuhNZcz6cSWXQtFYRa7XD0dv5zeIIvOJABdpMNIGcufMCj+ smI7UNG6fube63IZNEBdD1aqgdnY8hUKHWguxhaLNAe1mqOFDt8FntH69kST9pQn6f6b 7UKJDwKJ8+IAIE2T6ZpYZjufl19S5NcqT61C3owgK1xmBwViJun1A+qZJS/1lL72LP8G +MDw== MIME-Version: 1.0 X-Received: by 10.180.96.225 with SMTP id dv1mr2087842wib.37.1400053619174; Wed, 14 May 2014 00:46:59 -0700 (PDT) Received: by 10.216.242.196 with HTTP; Wed, 14 May 2014 00:46:59 -0700 (PDT) In-Reply-To: References: <53730FFB.5020304@gmail.com> Date: Wed, 14 May 2014 13:16:59 +0530 Message-ID: Subject: Re: ODBC : SQLGetData question From: Dev Kumkar To: aihtdikh@gmail.com Cc: "pgsql-odbc@postgresql.org" Content-Type: multipart/alternative; boundary=f46d04428a6ca3318604f957627e X-Pg-Spam-Score: -2.0 (--) 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 --f46d04428a6ca3318604f957627e Content-Type: text/plain; charset=UTF-8 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... --f46d04428a6ca3318604f957627e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On W= ed, May 14, 2014 at 12:51 PM, Dev Kumkar <devdas.kumkar@gmail.com> wrote:
On Wed, May 1= 4, 2014 at 12:10 PM, aihtdikh <aihtdikh@gmail.com> wrote:
Hi,

SQLGetData expects the buffer length parameter to be a SQLLEN variable, whi= ch 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 i= s defined as SQLLEN
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 SQLLEN=C2=A0 my_buff_= len;


=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 SQLGetData(my_st= mt, my_col_no, SQL_C_CHAR, &my_max_len, 0, &my_buff_len)

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (my_buff_len = =3D=3D SQL_NULL_DATA)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {
<= div>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // D= oesn't come here
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } <= br>
What is being missed above?

Regards...<= br>

if ((int)my_buff_len =3D=3D SQL_NULL_DATA)
=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // will come here
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 }

The = above casting solves the problem, please review?

Regards...
--f46d04428a6ca3318604f957627e--