[freetds] Null Handling of VarChar Columns
ZIGLIO, Frediano, VF-IT
Frediano.Ziglio at vodafone.com
Tue Nov 27 10:25:46 EST 2007
>
> We have now got to the bottom of this and I believe there are
> some real
> underlying issues:
>
> The NULL indicator does in fact function correctly, there was an error
> in our test harness (missing an &) meaning that we were passing the
> contents of our indicator variable, rather than it's address!
>
> However, the other problem stands in that when a query returns a NULL
> string column, the contents of the data buffer is not cleared and the
> string that was last stored in the bound variable is still there. The
> library documentation states that the standard behaviour would be to
> place a zero length null terminated string in this buffer, which is
> obviously more sensible behaviour.
>
I just wrote a test and tested with both our library and Sybase one.
Buffer is not terminated on NULLs!
See
http://freetds.cvs.sourceforge.net/freetds/freetds/src/dblib/unittests/n
ull2.c?view=markup
So the behavior of FreeTDS (at least of CVS HEAD) is correct.
I don't know however how dbbind works with -1 as varlen.
bye
freddy77
More information about the FreeTDS
mailing list