[freetds] Problems with UnixODBC and FreeTDS
Frediano Ziglio
freddy77 at gmail.com
Wed Jul 11 03:26:51 EDT 2007
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
More information about the FreeTDS
mailing list