[freetds] Bug in ct_get_data
Thompson, Bill D (London)
bill_d_thompson at ml.com
Mon Jan 17 04:53:36 EST 2005
Eddy,
thanks for the report, and welcome to the project!
Your fix makes functional sense.
We have a function for determining the null-ness of a returned datum.
using this, I think your fix would look like:
- srclen = curcol->column_cur_size;
+ if (tds_get_null(resinfo->current_row, (item - 1)))
+ srclen = 0;
+ else
+ srclen = curcol->column_cur_size;
Would you like to check that out with your program ?
Thanks again,
Bill
-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Edward
Macnaghten
Sent: 17 January 2005 09:05
To: freetds at lists.ibiblio.org
Subject: [freetds] Bug in ct_get_data
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
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
--------------------------------------------------------
If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail. http://www.ml.com/email_terms/
--------------------------------------------------------
More information about the FreeTDS
mailing list