Skip to Content.
Sympa Menu

freetds - Re: [freetds] Problems with UnixODBC and FreeTDS

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Frediano Ziglio" <freddy77 AT gmail.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Problems with UnixODBC and FreeTDS
  • Date: Wed, 11 Jul 2007 09:26:51 +0200

2007/7/10, Luke Benstead <kazade AT gmail.com>:

I've managed to work out exactly when it crashes. If you select a text
field
that is blank (i.e not NULL but empty) it crashes, here is the minimal
python code:

import pyodbc

if __name__ == '__main__':
strSQL="""
SELECT BlankField FROM SomeTable
"""
cnxn = pyodbc.connect
('DRIVER={FreeTDS};SERVERNAME=server;DATABASE=db;UID=user;PWD=password')
cursor = cnxn.cursor()
cursor.execute(strSQL)
print cursor.fetchall()

Hope that helps.

Luke.



Ok, I understand the problem. When text is empty SQL_NO_DATA is returned and
string is not null-terminated. On the first call SQLGetData should return
SQL_SUCCESS instead. Note that pyODBC should check SQLGetData results.
Currently I'm attempting a course at Milano so I'm not able to do a
patch for this problem... expect a patch for next week... if I don't find an
alternate way before...

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page