[SQL-CVS] r3959 - SQLObject/trunk/sqlobject/postgres
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2009-08-13 16:54:29
|
Author: phd Date: 2009-08-13 10:54:18 -0600 (Thu, 13 Aug 2009) New Revision: 3959 Modified: SQLObject/trunk/sqlobject/postgres/pgconnection.py Log: SET client_encoding TO the value of '?charset=' parameter in DB URI. Modified: SQLObject/trunk/sqlobject/postgres/pgconnection.py =================================================================== --- SQLObject/trunk/sqlobject/postgres/pgconnection.py 2009-08-13 16:53:03 UTC (rev 3958) +++ SQLObject/trunk/sqlobject/postgres/pgconnection.py 2009-08-13 16:54:18 UTC (rev 3959) @@ -86,6 +86,10 @@ self.dsn = dsn self.unicodeCols = unicodeCols self.schema = kw.pop('schema', None) + if "charset" in kw: + self.dbEncoding = self.kw["charset"] = kw.pop("charset") + else: + self.dbEncoding = None DBAPI.__init__(self, **kw) def connectionFromURI(cls, uri): @@ -118,6 +122,9 @@ if self.schema: c = conn.cursor() c.execute("SET search_path TO " + self.schema) + dbEncoding = self.dbEncoding + if dbEncoding: + conn.query("SET client_encoding TO %s" % dbEncoding) return conn def _queryInsertID(self, conn, soInstance, id, names, values): |