Commit eb7b49e6 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Log queries.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15203 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bc84ddb5
...@@ -88,7 +88,7 @@ __version__='$Revision: 1.20 $'[11:-2] ...@@ -88,7 +88,7 @@ __version__='$Revision: 1.20 $'[11:-2]
import _mysql import _mysql
import MySQLdb import MySQLdb
from _mysql_exceptions import OperationalError, NotSupportedError from _mysql_exceptions import OperationalError, NotSupportedError, ProgrammingError
MySQLdb_version_required = (0,9,2) MySQLdb_version_required = (0,9,2)
_v = getattr(_mysql, 'version_info', (0,0,0)) _v = getattr(_mysql, 'version_info', (0,0,0))
...@@ -386,11 +386,15 @@ class DB(TM): ...@@ -386,11 +386,15 @@ class DB(TM):
raise OperationalError(m[0], '%s: %s' % (m[1], query)) raise OperationalError(m[0], '%s: %s' % (m[1], query))
if ((not force_reconnect) and \ if ((not force_reconnect) and \
(self._mysql_lock or self._transactions)) or \ (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 raise
# Hm. maybe the db is hosed. Let's restart it. # Hm. maybe the db is hosed. Let's restart it.
self._forceReconnection() self._forceReconnection()
self.db.query(query) self.db.query(query)
except ProgrammingError:
LOG('ZMySQLDA', ERROR, 'query failed: %s' % (query,))
raise
return self.db.store_result() return self.db.store_result()
def query(self,query_string, max_rows=1000): def query(self,query_string, max_rows=1000):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment