[Erp5-report] r37263 yo - /erp5/trunk/products/ZMySQLDA/db.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sat Jul 24 04:05:23 CEST 2010


Author: yo
Date: Sat Jul 24 04:05:23 2010
New Revision: 37263

URL: http://svn.erp5.org?rev=37263&view=rev
Log:
Add a workaround for a problem that MySQLdb does not deal with programming errors well.

Modified:
    erp5/trunk/products/ZMySQLDA/db.py

Modified: erp5/trunk/products/ZMySQLDA/db.py
URL: http://svn.erp5.org/erp5/trunk/products/ZMySQLDA/db.py?rev=37263&r1=37262&r2=37263&view=diff
==============================================================================
--- erp5/trunk/products/ZMySQLDA/db.py [utf8] (original)
+++ erp5/trunk/products/ZMySQLDA/db.py [utf8] Sat Jul 24 04:05:23 2010
@@ -410,6 +410,10 @@ class DB(TM):
             self.db.query(query)
         except ProgrammingError, exception:
           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:
             # You have an error in your SQL syntax
             # Replace MySQL brain dead error message with a more meaningful




More information about the Erp5-report mailing list