Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vt7kk-00039W-5h for pgsql-odbc@arkaria.postgresql.org; Wed, 18 Dec 2013 03:24:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vt7kj-0000ua-LI for pgsql-odbc@arkaria.postgresql.org; Wed, 18 Dec 2013 03:24:53 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vt7ki-0000t6-8W for pgsql-odbc@postgresql.org; Wed, 18 Dec 2013 03:24:52 +0000 Received: from sd.tpf.co.jp ([210.161.239.34]) by makus.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vt7ke-0000K6-E0 for pgsql-odbc@postgresql.org; Wed, 18 Dec 2013 03:24:51 +0000 Received: (qmail 2267 invoked by uid 512); 18 Dec 2013 03:24:45 -0000 Received: from unknown (HELO ?127.0.0.1?) (100.126.1.62) by sd2.tpf-fw-c.co.jp with SMTP; 18 Dec 2013 03:24:45 -0000 Message-ID: <52B1157C.2030100@tpf.co.jp> Date: Wed, 18 Dec 2013 12:24:44 +0900 From: "Inoue, Hiroshi" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Daniel Homerick , "pgsql-odbc@postgresql.org" Subject: Re: Length of bytea References: <9570C4F8577FC041964C389777970D7744BC2613B4@KITT.sensingsystems.com> In-Reply-To: <9570C4F8577FC041964C389777970D7744BC2613B4@KITT.sensingsystems.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.4 (--) 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 Daniel, Please try to turn on *bytea as LO* option. regards, Hiroshi Inoue (2013/12/18 9:48), Daniel Homerick wrote: > When I use the SQLColAttribute function to get the either the > SQL_DESC_LENGTH or SQL_DESC_OCTET_LENGTH attribute, a bytea column > reports the “Max Varchar” configuration value (255 by default), even > when the actual data length is longer. This appears to be the case when > the “Unknown Sizes” configuration option is at either the default > “Maximum” value, or the “Don’t Know” option. > > I ran into this as a problem when trying to determine an appropriate > buffer size for use by SQLBindCol. When I would naively use the reported > size for my buffer, a segfault was never far behind. > > In my case, I can’t particularly trust that the system will always be > set up with the “Unknown Sizes” config option set to “Longest”. And > since the “Max Varchar” is a user configurable value, I can’t just > special case my code to treat 255 as a magic value. With the potential > for crashing my app if the ODBC isn’t configured as expected, I’m > currently thinking that I’ll need to always use SQLGetData over > SQLBindCol when using Postgres and dealing with bytea columns. > > Is there some other function or attribute I should be using in order to > determine a bytea column’s actual length? > > Alternatively, is there a function I can call to get the “Max Varchar” > value, so that I can use it to compare (and not trust the value if it > matches)? > > Are there other approaches that I should explore instead? > > As an aside, psqlODBC’s behavior here doesn’t really seem to jive with > Microsoft’s ODBC documentation: > http://msdn.microsoft.com/en-us/library/ms713558(v=vs.85).aspx -- I am using the free version of SPAMfighter. SPAMfighter has removed 1300 of my spam emails to date. Get the free SPAMfighter here: http://www.spamfighter.com/len Do you have a slow PC? Try a Free scan http://www.spamfighter.com/SLOW-PCfighter?cid=sigen -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc