On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
> On Tue, Nov 27, 2007 at 05:54:41PM +0100, Markus Gritsch wrote:
> > Since it is allowed to use unicode and strings in a query, why is
> > there a need to force unicode?
>
> There were reports that MySQLdb 1.2.1+ requires unicode, not merely
> allows it.
I cannot confirm this. I use MySQL_python-1.2.2-py2.5-win32.egg and
the following example works fine.
from sqlobject import *
sqlhub.threadConnection = connectionForURI(
'mysql://[EMAIL
PROTECTED]/test?use_unicode=1&charset=utf8&sqlobject_encoding=utf-8')
class Person(SQLObject):
uname = UnicodeCol()
sname = StringCol()
Person.dropTable(ifExists=True)
Person.createTable()
p = Person(uname='\x61', sname='\x61') # '\x61' is 'a'
result = Person.select()[0]
assert result.uname == '\x61' # ok
assert result.sname == '\x61' # ok
print result.uname, result.sname # -> a a
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss