[cx-oracle-users] Unicode and cx_Oracle
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2011-02-19 04:36:09
|
All, I have just checked in changes to cx_Oracle (Subversion trunk) to support using Unicode throughout and completely eliminated "unicode" mode. What this means is that for Python 2.x you can now use Unicode for connection strings, SQL statements, etc. The changes were quite substantial so even though the test suite passed without any errors I would still appreciate those who use unicode on a regular basis and/or those who used the old unicode mode to test it out before I make a new release (which will be 5.1). I will be testing it at work over the next week or so as well to see if any real-world situations turn up that were missed by the test suite. For the UnicodeVar part of the test suite you need to set NLS_LANG to .UTF8 or some other character set that supports unicode point 3042; otherwise, you will get errors. If you wish to return all strings as unicode, you can do this def OutputTypeHandler(cursor, name, defaultType, size, precision, scale): if defaultType in (cx_Oracle.STRING, cx_Oracle.FIXED_CHAR): return cursor.var(unicode, size, cursor.arraysize) connection = cx_Oracle.Connection("user/password@dsn") connection.outputtypehandler = OutputTypeHandler I am still considering whether or not to make that process a little simpler so if you have any opinions on that or suggestions about how to go about it, I'm all ears. :-) Thanks. Anthony |