Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkSsG-0002FW-Ry for pgsql-odbc@arkaria.postgresql.org; Wed, 14 May 2014 06:41:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WkSsG-0004xm-As for pgsql-odbc@arkaria.postgresql.org; Wed, 14 May 2014 06:41:08 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkSsF-0004xg-O3 for pgsql-odbc@postgresql.org; Wed, 14 May 2014 06:41:07 +0000 Received: from mail-pb0-x22c.google.com ([2607:f8b0:400e:c01::22c]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkSsD-0000h5-9i for pgsql-odbc@postgresql.org; Wed, 14 May 2014 06:41:06 +0000 Received: by mail-pb0-f44.google.com with SMTP id rq2so1294640pbb.17 for ; Tue, 13 May 2014 23:41:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:reply-to:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=9lAppTuvqsv4Gy9qi2G4vLi+ITNI8TTucbRZhLmAufE=; b=T/bvETHGU4Q4Zu8u6C31kpglEsIY1wGD5Di3b/CFJgaMdEfLLZzHSBFIEB+MVrDZt6 0NTZ8d14sY4DvS2fjEAQ0cVOm8MV3jJrnLPH87rB7p2j5wZgt1m087/m2RfNg0l5CTXO ZBkPadbrR+Lk05aE+T2HljMJOKfDKJTbtE3i5uOJSWXVdzptGFoAmmX/ZQrLp2A2Fv9H t6Q9oCx2AgTNhzuCblIMZwJgBDDXyYLtnbQSIdbRXoNei5LS5ov3BGHpSyAH5I3digE/ 4sTLcqYz0mu4aicLpr66ZrMib15PWpLxplMqR1VGnWqQ9pXvErSkXoEBj6w6FOysCrua 4X2A== X-Received: by 10.68.197.134 with SMTP id iu6mr2067852pbc.164.1400049664481; Tue, 13 May 2014 23:41:04 -0700 (PDT) Received: from [10.128.70.87] (dsl-58-6-192-58.wa.westnet.com.au. [58.6.192.58]) by mx.google.com with ESMTPSA id xw5sm3979416pab.30.2014.05.13.23.41.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 23:41:03 -0700 (PDT) Message-ID: <53730FFB.5020304@gmail.com> Date: Wed, 14 May 2014 14:40:59 +0800 From: aihtdikh Reply-To: aihtdikh@gmail.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: pgsql-odbc@postgresql.org Subject: Re: ODBC : SQLGetData question References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 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