Skip to Content.
Sympa Menu

freetds - Re: [freetds] SQLGetData() returns len 4095 for empty TEXT on AIX 6.1 without ClientCharset defined

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Sebastien FLAESCH <sf AT 4js.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] SQLGetData() returns len 4095 for empty TEXT on AIX 6.1 without ClientCharset defined
  • Date: Fri, 05 Apr 2013 09:09:47 +0200

Frediano,

I am not 100% sure it's a problem in AIX iconv:

Read the man pages of iconv on Linux...

http://linux.die.net/man/3/iconv

"
A different case is when inbuf is NULL or *inbuf is NULL, but outbuf is not
NULL and *outbuf is not NULL. In this case, the iconv() function attempts
to set cd's conversion state to the initial state and store a corresponding
shift sequence at *outbuf. At most *outbytesleft bytes, starting at *outbuf,
will be written. If the output buffer has no more room for this reset
sequence,
it sets errno to E2BIG and returns (size_t) -1. Otherwise it increments
*outbuf and decrements *outbytesleft by the number of bytes written.
"

Seb

On 04/04/2013 08:43 PM, Frediano Ziglio wrote:
Found!

Actually the problem is in iconv AIX implementation, iconv is a function
like

size_t iconv(iconv_t cd,
char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft);

if *inbuf is NULL and *inbytesleft is 0 AIX threat input as an infinite
buffer with zeroes so it convert an empty string (cause for libTDS view is
an empty string) to a set of zeroes (actually up to the output buffer which
is 4095 if you take into account space for terminator).

The simpler fix is to test and assume empty string if *inbytesleft == 0 in
tds_iconv.

Frediano



2013/4/2 Sebastien FLAESCH<sf AT 4js.com>

Ok thanks.
We'll setup one of our AIX machines to give you access.
Seb

On 03/30/2013 04:24 PM, Frediano Ziglio wrote:
Can I have access to one of the AIX machines ??

I'm currently on holidays, I'll be back on Thursday.

Frediano


_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds

_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds






Archive powered by MHonArc 2.6.24.

Top of Page