[freetds] SQLGetData returns same value for subsequent calls?

Matt Lilley matt.lilley at securitease.com
Wed Nov 22 17:28:58 EST 2006


Hi,

I've been trying to connect to my MS SQL 2k database using freeTDS and 
noticed that subsequent calls to SQLGetData seem to return the same 
value, at least on the columns I am interested in (large VARCHAR 
columns). My understanding is that even if all the data is returned in 
the first call then a subsequent call should return SQL_NO_DATA, but the 
case I was testing had only returned the first 128 bytes of the column. 
According to tds.h VARCHAR is not a blob_type, so in src/odbc/odbc.c 
(around line 4100) colinfo->column_text_sqlgetdatapos doesn't get 
incremented. Attached is a patch which fixes the symptoms for me, but is 
unlikely to be the correct solution (given that I know almost nothing 
about the internal workings of databases) In any case it should be 
sufficient for someone to spot the real problem and correct it. The 
patch is against the nightly build freetds-0.65.dev.20061121. I hope the 
format etc is acceptable - I only rarely submit patches!

Regards,
Matt

--  
_____________________________________________
Matt Lilley
Software Engineer
SecuritEase

Tel:    +64 4 917-6670
Fax:    +64 4 917-6671
E-mail: matt.lilley at securitease.com
Web:    http://www.securitease.com
_____________________________________________

This e-mail passed SSS's content security scan.
It is covered by the confidentiality clauses at
http://www.sss.co.nz/content_and_confidentiality

-------------- next part --------------
A non-text attachment was scrubbed...
Name: freetds-0.65-column_cursor.patch
Type: text/x-diff
Size: 1338 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20061123/79c79f2e/attachment.bin 


More information about the FreeTDS mailing list