From eb7b49e6dfae17ac661ee7628e3df2264ad66f4f Mon Sep 17 00:00:00 2001 From: Yoshinori Okuji <yo@nexedi.com> Date: Thu, 12 Jul 2007 14:21:21 +0000 Subject: [PATCH] Log queries. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15203 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ZMySQLDA/db.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/product/ZMySQLDA/db.py b/product/ZMySQLDA/db.py index 20502e6d24..8bb86f9c3d 100644 --- a/product/ZMySQLDA/db.py +++ b/product/ZMySQLDA/db.py @@ -88,7 +88,7 @@ __version__='$Revision: 1.20 $'[11:-2] import _mysql import MySQLdb -from _mysql_exceptions import OperationalError, NotSupportedError +from _mysql_exceptions import OperationalError, NotSupportedError, ProgrammingError MySQLdb_version_required = (0,9,2) _v = getattr(_mysql, 'version_info', (0,0,0)) @@ -386,11 +386,15 @@ class DB(TM): raise OperationalError(m[0], '%s: %s' % (m[1], query)) if ((not force_reconnect) and \ (self._mysql_lock or self._transactions)) or \ - m[0] not in hosed_connection: + m[0] not in hosed_connection: + LOG('ZMySQLDA', ERROR, 'query failed: %s' % (query,)) raise # Hm. maybe the db is hosed. Let's restart it. self._forceReconnection() self.db.query(query) + except ProgrammingError: + LOG('ZMySQLDA', ERROR, 'query failed: %s' % (query,)) + raise return self.db.store_result() def query(self,query_string, max_rows=1000): -- 2.30.9