| Issue 97: | Select with empty 'text' field causes MemoryError when unicode_strings=True on Ubuntu/FreeTDS/iODBC | |
| 4 people starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem?
1. conn=connect('...', unicode_strings=True)
2. c = conn.execute('SELECT TOP 1 text_field FROM aTable')
print c.fetchone() # where text_field is NULL
What is the expected output? What do you see instead?
Expected 'None' or empty string. Causes MemoryError exception where
unicode_strings=True
What version of the product are you using? On what operating system?
pyODBC 2.1.7, Ubuntu 9.04+, FreeTDS/tdsodbc 0.82-14 shipped with Ubuntu
python 2.5.x, 2.6.2
Please provide any additional information below.
Looks like some conversion error. Executing 'select DATALENGTH(text_field)'
returns 'None'
Apr 16, 2010
Project Member
#1
mkleehammer
Status:
Investigating
Apr 16, 2010
Another thing I noticed, the value you want is "unicode_results", not "unicode_strings". (I know this seems error prone, but lots of people like to use keywords to pass the DSN values and it is a DB API standard, so I allow it. If I don't recognize the keyword, it simply gets added to the DSN.) Can you confirm which you were using?
Apr 18, 2010
The sys.maxunicode == 1114111 == 0x10FFFF. On my (other) win64 machine maxunicode==65535. Of course, "unicode_results". Yes, I will try your custom pyd.
Nov 17, 2010
I've also encountered this error, except the type I've encountered it on is nvarchar and it doesn't matter what unicode_results is. My configuration: pyodbc 2.1.8 FreeTDS CVS checkout from 11/16/2010 MacOS X 10.6.4 Python 2.6 iODBC driver manager SQL Server 2008 RTM I get the same behavior as the reporter with 'select DATALENGTH...' on the relevant column. sys.maxunicode = 65535
Dec 26, 2011
I'm closing this because I believe it is fixed in the 3.0.x builds. Also, Microsoft now has a Linux driver which definitely works.
Status:
Complete
Oct 9, 2013
Still encountering this issue on OS/X. iODBC and FreeTDS. |