[egenix-users] Two bugs in mxODBC: storing empty string and unicode string

Harri Pesonen harri.pesonen at wicom.com
Mon Aug 13 10:38:16 CEST 2007


We are currently using version 2 of mxODBC, but there are a couple of problems:
 
1) Empty string "" is converted to maximum length string (varchar(8000) or
nvarchar(4000)) when data is stored into database.
2) Unicode string u"abc" is converted to u"abc   ", so that there are equal
number of extra spaces in the end, when data is stored into database.
 
We are using SQL Server 2005 and Python 2.4.4 (and Windows XP). Both of these
problems must be worked around somehow, but the solution is not easy.
 
1) We use string with 1 character (space) or None (NULL). The problem is because
there is no such datatype as char(0). varchar(0) would work.
2) Workaround not yet found. Except not to use unicode. It is clear that mxODBC
calculates first the number of bytes, and then uses that as number of
characters, which is twice too much.
 
I don't know if these problems are fixed in the latest release, mxODBC 3.
 
Thanks, Harri Pesonen




More information about the egenix-users mailing list