[SQL-CVS] r1594 - SQLObject/trunk/sqlobject/mysql
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2006-02-11 10:33:09
|
Author: ianb Date: 2006-02-11 03:33:06 -0700 (Sat, 11 Feb 2006) New Revision: 1594 Modified: SQLObject/trunk/sqlobject/mysql/mysqlconnection.py Log: Applied SF [ 1421263 ] configurable client character set (encoding) for MySQL from Maxim F. Ischenko Modified: SQLObject/trunk/sqlobject/mysql/mysqlconnection.py =================================================================== --- SQLObject/trunk/sqlobject/mysql/mysqlconnection.py 2006-02-11 10:30:03 UTC (rev 1593) +++ SQLObject/trunk/sqlobject/mysql/mysqlconnection.py 2006-02-11 10:33:06 UTC (rev 1594) @@ -18,6 +18,10 @@ self.db = db self.user = user self.password = password + if kw.has_key('client_encoding'): + self.client_encoding = col.popKey(kw, 'client_encoding') + else: + self.client_encoding = None self.kw = {} for key in ("unix_socket", "named_pipe", "init_command", "read_default_file", "read_default_group"): @@ -47,6 +51,8 @@ if hasattr(conn, 'autocommit'): conn.autocommit(bool(self.autoCommit)) + if self.client_encoding: + conn.query('SET NAMES ' + self.client_encoding) return conn |