Skip to Content.
Sympa Menu

freetds - Re: [freetds] Null Handling of VarChar Columns

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Null Handling of VarChar Columns
  • Date: Tue, 27 Nov 2007 16:25:46 +0100

>
> 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




Archive powered by MHonArc 2.6.24.

Top of Page