[freetds] FreeTDS (CVS version) hangs on reading column data larger than 256 bytes

James K. Lowden jklowden at schemamania.org
Sun Apr 13 23:28:01 EDT 2003


On Sun, 13 Apr 2003 17:10:40 -0700 (PDT), Chad Wagner <vdr781 at yahoo.com>
wrote:
> Attached is a patch which appears to fix this problem.
>  A good test for it is "SELECT @@version", when the
> column data exceeds the temp space the routine needs
> to loop twice to do the conversion, but in_left is
> adjusted to 0 by iconv routines, which then in_left
> would need to be adjusted to the remaining data on the
> wire to do the final conversion on remaining data.

Thanks, Chad!  

I read your message nodding my head (uh-huh, yup...) because it so happens
I worked on that very loop today.  It also had a problem if the character
set didn't use an even byte/char ratio (as, say, would be the case with
UTF-8).  If the byte sequence  of the last "character" didn't completely
fit in temp[], tds_iconv() would refuse to convert it, and it would be
discarded.  

I changed the logic to retain a partial-character sequence, move it to the
front of temp[], and continue.  It's rather heavily logged atm; we can
lighten up when we're sure it's OK.  

Please tell us about anything else you find.  I'm gaining confidence that
we're now once more able to handle server-side UCS-2 and ISO-8859*, and I
think we've got client-side UTF-8 working within libtds.  Have to focus on
the client libraries next.  

--jkl



More information about the FreeTDS mailing list