[freetds] SQLGetData (bug in ODBC driver)

James K. Lowden jklowden at freetds.org
Wed Jun 11 23:19:47 EDT 2008

Suren A. Chilingaryan wrote:
> Dear developers,
> FreeTDS 0.82 ODBC driver is corrupting data if SQLGetData is called
> multiple times on a single column and if the data conversion have been
> involved.
> The patch is available at:
> http://dside.dyndns.org/projects/patches.dir/freetds-ds-odbc.patch


Thank you kindly for your analysis and patch.  I modified it to conform
with FreeTDS style (and some preferences of my own) and applied it to CVS
HEAD.  I also posted the modified patch at


Checking in src/odbc/odbc.c;
/cvsroot/freetds/freetds/src/odbc/odbc.c,v  <--  odbc.c
new revision: 1.482; previous revision: 1.481

I applied your patch because it looks reasonable and doesn't break any
unit tests,[1] and to save Frediano some effort.  I'm not set up to test
it, though.  

If you would like to, there are a couple of other things you could do that
would be very helpful:

1.  Apply my modification of your patch to your 0.82 installation, to
confirm it still works as it should.  

2.  Modify src/odbc/unittests/getdata.c to test the condition addressed by
the change.  

3.  Let us know.  

This sort of thing is quite tricky to get right.  A unit test could
confirm it's correct at the lowest level.  

Best regards, 


[1] My test server went down halfway through the tests, but getdata.c ran.

More information about the FreeTDS mailing list