Re: SQLGetData (bug in ODBC driver)

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
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

Suren, 

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

http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/SQLGetData.utf8.odbc.c.diff.

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, 

--jkl

[1] My test server went down halfway through the tests, but getdata.c ran.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.