[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r6864 - trunk/gnue-common/src/datasources/drivers/postgresql/Base
From: |
reinhard |
Subject: |
r6864 - trunk/gnue-common/src/datasources/drivers/postgresql/Base |
Date: |
Wed, 5 Jan 2005 13:34:19 -0600 (CST) |
Author: reinhard
Date: 2005-01-05 13:34:18 -0600 (Wed, 05 Jan 2005)
New Revision: 6864
Modified:
trunk/gnue-common/src/datasources/drivers/postgresql/Base/Connection.py
Log:
Set client encoding for every new transaction, as it gets lost whenever a new
transaction is started.
Modified:
trunk/gnue-common/src/datasources/drivers/postgresql/Base/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/postgresql/Base/Connection.py
2005-01-05 14:11:25 UTC (rev 6863)
+++ trunk/gnue-common/src/datasources/drivers/postgresql/Base/Connection.py
2005-01-05 19:34:18 UTC (rev 6864)
@@ -94,17 +94,27 @@
gDebug (1, u_("Encoding '%s' is not supported by postgresql dbdriver. "
"Using default encoding.") % self._encoding)
- if self._pg_encoding not in ["", 'DEFAULT']:
- gDebug (1, 'Setting postgresql client_encoding to %s (%s)' \
- % (self._pg_encoding, self._encoding))
- self.sql ("SET CLIENT_ENCODING TO '%s'" % self._pg_encoding)
-
dtfmt = connectData.get ('datetimeformat', "%Y-%m-%d %H:%M:%S")
self._dateTimeFormat = "'%s'" % dtfmt
gDebug (1, "datetime-format set to %s" % self._dateTimeFormat)
+ # FIXME: Why isn't this generally done for any new connection?
+ self._beginTransaction ()
+ # ---------------------------------------------------------------------------
+ # Done at the start of each transaction
+ # ---------------------------------------------------------------------------
+
+ def _beginTransaction (self):
+
+ # Must set CLIENT_ENCODING per transaction as it is reset on COMMIT or
+ # ROLLBACK.
+
+ if self._pg_encoding not in ["", 'DEFAULT']:
+ self.sql ("SET CLIENT_ENCODING TO '%s'" % self._pg_encoding)
+
+
# ===========================================================================
# Extensions to the basic GConnection object
# ===========================================================================
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r6864 - trunk/gnue-common/src/datasources/drivers/postgresql/Base,
reinhard <=