Skip to Content.
Sympa Menu

freetds - [freetds] Bug in ct_get_data

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Edward Macnaghten <eddy AT edlsystems.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] Bug in ct_get_data
  • Date: Mon, 17 Jan 2005 09:05:24 +0000

Hi

I am new to this list so please forgive me if this is out of order....

I have 2 pieces of news -
1 - I have found a bug
2 - I think I have fixed it

The bug is in ct_get_data. It manifests when you are returning a row set, and a character type is null when the same column in the preceding row was not. ct_get_data does not check the "Null" mask so therefore the same value is returned again (as it still is in the buffer).

The fix..., in ctlib/ct.c - in th ct_get_data() function, about line 1988 replace

srclen = curcol->column_cur_size;


with

/*
* Fix by eddy AT edlsystems.com
*
* To take notice if column is null
*/

{
int bytenum = ((unsigned int) item - 1) / 8u;
int bit = ((unsigned int) item - 1) % 8u;
unsigned char mask = 1 << bit;

if(resinfo->current_row[bytenum] & mask)
srclen = 0;
else
srclen = curcol->column_cur_size;

}

/*
* End of FIX by eddy AT edlsystems.com
*/

seems to do the trick.

This is not a propper "patch" as there are probably better ways of doing this. Also, I am not that familiar with freetds internals, and although it may work for me, it may not be the "comprehensive" solution required.

I apologize if this has been covered, or if this is the wrong place for this, or I have submitted this the wrong way...

Enjoy

Eddy






Archive powered by MHonArc 2.6.24.

Top of Page