Skip to Content.
Sympa Menu

freetds - Re: MS-SQL 7.0, sqsh, not returning null values

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT umcc.ais.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Cc: odunbar AT netkonect.net
  • Subject: Re: MS-SQL 7.0, sqsh, not returning null values
  • Date: Fri, 18 Feb 2000 18:48:30 -0500 (EST)



I found this problem. It affects only TDS 7.0 as you have guessed.

With 7.0, Microsoft introduced long char types (char, varchar, etc...).
These have a two byte (16 bit) length. For 8 bit length types, NULL is
represented by 0. Problem is you can't tell the difference between a zero
length varchar and a null one (insert '' into a varchar and it is actually
represented by a single space ' ').

So microsoft's (not bad) solution is to to represent NULL with 65355
(0xFFFF or -1 using signed int). So, here is a little patch to fix
it...in tds_process_row() (token.c):

} else if (is_large_type(curcol->column_xtype)) {
colsize = tds_get_smallint(tds);
+ if (colsize==-1) colsize=0;
} else if (!is_fixed_type(curcol->column_type)) {

I also checked it into CVS.

Cheers,

Brian

On Fri, 18 Feb 2000, Bill Doulass wrote:

> I tried downsizing to TDSVER=42, and the NULL problem went away. I will
> continue to work with this version for the time being.
>
> Thanks again, all.
>





Archive powered by MHonArc 2.6.24.

Top of Page