Commit d381a451 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Add a workaround for a problem that MySQLdb does not deal with programming errors well.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37263 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e80e8298
...@@ -410,6 +410,10 @@ class DB(TM): ...@@ -410,6 +410,10 @@ class DB(TM):
self.db.query(query) self.db.query(query)
except ProgrammingError, exception: except ProgrammingError, exception:
LOG('ZMySQLDA', ERROR, 'query failed: %s' % (query,)) LOG('ZMySQLDA', ERROR, 'query failed: %s' % (query,))
# XXX sometimes, after a programming error, the database object
# gets fully broken and non-functional. So recover it by
# recreation.
self._forceReconnection()
if exception[0] == ER.PARSE_ERROR: if exception[0] == ER.PARSE_ERROR:
# You have an error in your SQL syntax # You have an error in your SQL syntax
# Replace MySQL brain dead error message with a more meaningful # Replace MySQL brain dead error message with a more meaningful
......
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