[freetds] One failing unit test (iconv_read) on git master on OS X

Marc Abramowitz marca at surveymonkey.com
Mon Sep 16 09:56:20 EDT 2013

On 9/16/13 12:44 AM, "Frediano Ziglio" <freddy77 at gmail.com> wrote:

>2013/9/15 Marc Abramowitz <marca at surveymonkey.com>:
>>Interesting data point: If I make the following change, then it makes the
>> iconv_read test pass (although it makes a few other tests fail and one
>> hangs):
>> https://gist.github.com/msabramo/6574246
>I would call it workaround!

I would call it a hack, since it breaks other tests. :-)

>> So it appears that it has something to do with it not allocating a big
>> enough buffer to not passing the right size.
>No, libTDS is expected to handle it and reallocate the buffer as
>needed. The function is expected to handle whatever file length so
>it's not always possible to understand the right size in advance.

Yeah, afterwards, I looked a little more and I can see that
tds_dynamic_stream_init and tds_dynamic_stream_write set up a stream that
should reallocate as needed. But beyond that, I'm having trouble following
the details of how it works. tds_iconv was particularly hard for me to
grok. I sent a few PRs to improve logging slightly, but I might not get
further than that.

I wonder if this means that FreeTDS has trouble with VARCHAR fields > 1024
bytes? I suppose I could test that.

More information about the FreeTDS mailing list