Bugs item #2798331, was opened at 2009-05-29 12:16
Message generated for change (Tracker Item Submitted) made by plewy
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2798331&group_id=56967
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: SQL/ODBC
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Pawel Lewicki (plewy)
Assigned to: Sjoerd Mullender (sjoerd)
Summary: ODBC - broken 'utf-8' data
Initial Comment:
The same problem as reported in #2014118
SQL queries executed using ODBC driver are not properly transferred. Inserted
data has broken utf-8 characters.
Broken data is recognized by "LIKE" queries if using the same driver (ODBC vs
native Python bindings).
Windows 32-bit Feb2009-SP2 release.
ODBC driver version is 1.28.04.01
>>> import MonetSQLdb
>>> testStr = 'us\xc5\x82ugi'
>>> conPython= MonetSQLdb.connect(host = 'localhost', user = 'monetdb',
>>> password = 'monetdb', lang = 'sql', dbname='demo')
>>> cuPython = con.cursor()
>>> cuPython.execute("CREATE TABLE testtable (testfield varchar(30))")
0
>>> cuPython.execute("INSERT INTO testtable VALUES ('%s')"%testStr)
1
>>> cuPython.execute("SELECT * FROM testtable WHERE testfield LIKE
>>> '%s';"%testStr)
1
>>> print cuPython.fetchall()
[('us\xc5\x82ugi',)]
>>>
>>>
>>> import pyodbc
>>> conODBC = pyodbc.connect('DSN=demo')
>>> cuODBC = conODBC.cursor()
>>> cuODBC.execute("SELECT * FROM testtable WHERE testfield LIKE
>>> '%s';"%testStr)
<pyodbc.Cursor object at 0x00D322F8>
>>> print cuODBC.fetchall()
[]
>>> cuODBC.execute("INSERT INTO testtable VALUES ('%s')"%testStr)
1
>>> cuODBC.execute("COMMIT;") #only Python driver is in autocommit mode
0
>>> cuODBC.execute("SELECT * FROM testtable WHERE testfield LIKE '%s';"%testStr)
<pyodbc.Cursor object at 0x00D31100>
>>> print cuODBC.fetchall()
[('us\xc4\xb9\xe2\x80\x9augi', )]
>>> cuPython.execute("SELECT * FROM testtable")
2
>>> print cuPython.fetchall()
[('us\xc5\x82ugi',), ('us\xc4\xb9\xe2\x80\x9augi',)]
>>> cuODBC.execute("SELECT * FROM testtable")
<pyodbc.Cursor object at 0x00D31100>
>>> print cuODBC.fetchall()
[('us\xc5\x82ugi', ), ('us\xc4\xb9\xe2\x80\x9augi', )]
>>> cuPython.execute("DROP TABLE testtable")
0
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2798331&group_id=56967
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs