pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hiroshi Inoue <inoue@tpf.co.jp>
To: Heikki Linnakangas <hlinnakangas@vmware.com>
Cc: Nils Gösche <cartan@cartan.de>
Cc: pgsql-odbc@postgresql.org
Subject: Re: Null Characters in Strings, Version 9.3.1
Date: Thu, 20 Feb 2014 10:43:52 +0900
Message-ID: <53055DD8.2050309@tpf.co.jp> (raw)
In-Reply-To: <5304ADB1.6090306@vmware.com>
References: <006a01cf28e4$7c425450$74c6fcf0$@de>
	<003201cf2ccb$c5d6ddd0$51849970$@de>
	<5303960F.3050706@vmware.com>
	<003b01cf2ce1$2e33bc80$8a9b3580$@de>
	<5303C2EA.7060109@vmware.com>
	<5303F655.8000200@tpf.co.jp>
	<5304ADB1.6090306@vmware.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

(2014/02/19 22:12), Heikki Linnakangas wrote:
> On 02/19/2014 02:09 AM, Hiroshi Inoue wrote:
>> (2014/02/19 5:30), Heikki Linnakangas wrote:
>>> On 02/18/2014 09:39 PM, Nils Gösche wrote:
>>>> If I run this with version 9.2.1 of the driver (I am using 32 Bit
>>>> here), it will go to the else clause and print the value of the text
>>>> column. However, if I run this with the latest version, I get the
>>>> following output:
>>>
>>> Hmm. If you could pinpoint it to the exact commit that changed the
>>> behavior, that would help too.
>>
>> Maybe it's caused by the commit 3666c87c1440862bde2e6b8f43ee585deed70d31
>> Author: Hiroshi Inoue <inoue@tpf.co.p>
>> Date:   Thu Aug 22 20:40:01 2013 +0900
>>
>>       When LF->CR+LF conversion causes an buffer truncation, supress the
>> conversion (in case of unicode).
>>
>> Nils, please try to turn off *LF <-> CR/LF conversion* option.
>> Anyway I can't think of the way to cure the problem other than putting
>>    back the commit.
>
> Hmm, what was the point of that commit in the first place? I don't think
> it was a good idea. If your application needs CR+LF, it's not going to
> be happy if you sometimes don't do the conversion. Better to truncate.

The commit was for e.g. columns bound by SQLBindCols. In such cases
truncated data can't be seen any more. I forgot about SQLGetData()
when applying the commit.
I already put back the commit.

> While looking into this, I found the conversion functions difficult to
> debug, because it's defined by the def_utf2ucs macro. It would be much
> more natural to have one regular function with an argument to indicate
> if it should do error-checking. It used to be a regular function, but
> commit ca1daf08f0eef73222abcd8aafe96b8e29afff91 turned it into a macro.
> Not sure why; premature optimization perhaps?

I didn't want to open error-checking on the face because the use cases
  are considerably depended on luck.

> I propose the attached patch. It turns the utf8_to_ucs2_lf function back
> into a regular function, and reverts the troublesome commit
> 3666c87c1440862bde2e6b8f43ee585deed70d31. It also adds a regression test
> case similar to Nils'. Barring objections, I'll commit this.

I don't object to the patch.

regards,
Hiroshi Inoue


-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



view thread (15+ messages)  latest in thread

Message-ID: <53055DD8.2050309@tpf.co.jp>
Permalink:  ../53055DD8.2050309@tpf.co.jp/
Also on:    postgresql.org/message-id/53055DD8.2050309@tpf.co.jp

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: inoue@tpf.co.jp, hlinnakangas@vmware.com, cartan@cartan.de
  Subject: Re: Null Characters in Strings, Version 9.3.1
  In-Reply-To: <53055DD8.2050309@tpf.co.jp>
  References: <006a01cf28e4$7c425450$74c6fcf0$@de> <003201cf2ccb$c5d6ddd0$51849970$@de> <5303960F.3050706@vmware.com> <003b01cf2ce1$2e33bc80$8a9b3580$@de> <5303C2EA.7060109@vmware.com> <5303F655.8000200@tpf.co.jp> <5304ADB1.6090306@vmware.com> <53055DD8.2050309@tpf.co.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox