[freetds] Null Handling of VarChar Columns

Frediano Ziglio freddy77 at gmail.com
Sun Nov 25 03:12:01 EST 2007


Il giorno sab, 24/11/2007 alle 23.52 +0000, Simon Talbot ha scritto:
> Thanks James,
> 
> Interestingly on my test system, which is NOT current snapshot I get the
> following with your example query:
> 
> Data
> 
> -----------  ---
>           1  abc
>           2  def
>           3  NUL
>           4  ghi
>           5  ghi
>           6  jkl
> 
> Which shows the fault I refer to. 
> 
> 
> If I use a current snapshot (which we have not fully regression tested)

If you post your tests we could integrate them in our test suite. This
is the best way to assume every future versions will work as you expect.

> we get:
> 
> Data
> 
> -----------  ---
>           1  abc
>           2  def
>           3  NUL
>           4  ghi
>           5
>           6  jkl
> 
> Which does not exhibit the problem.
> 
> Taking a look at the changelog:
> 
> Thu Nov 15 14:32:50 CET 2007    Frediano Ziglio <freddy77_A_gmail_D_com>
> 	* src/dblib/unittests/.cvsignore src/dblib/dblib.c:
> 	* src/dblib/unittests/Makefile.am src/dblib/unittests/null.c:
> 	- fix problem with empty string and TEXT
> 	- add a test to test empty/NULL behavior of dbdatlen/dbdata
> 
> So it looks like some work which has been going has fixed the empty
> string problem whilst I have been investigating it, I was a week to
> early!
> 

No, this fix is about dbdata, not dbbind.

> That said though, following on from some of your other comments, in
> bsqldb the dbbind is performed in the following way:
> 
> erc = dbbind(dbproc, c+1, bindtype, -1, (BYTE *) data[c].buffer); 
> 
> Which is using -1 as the varlen -- I cannot see a definition of what -1
> as a varlen means anywere, but this would explain why bsqldb exhibited
> the problem in the version of the library we did most of our work with.
> 

I think -1 is handled like 0, there is always sufficient space (I really
don't suggest this stuff!! Overflows are around the corner)

> Simon
> 

bye
  Frediano





More information about the FreeTDS mailing list