Commits

Christian Boos committed ee70a83

0.10.4dev: ported r4962 to stable (''follow-up to r4342 and fix #4802'')

Comments (0)

Files changed (1)

trac/db/mysql_backend.py

                                   host=host, port=port, use_unicode=True)
             self._set_character_set(cnx, 'utf8')
         ConnectionWrapper.__init__(self, cnx)
+        self._is_closed = False
 
     def cast(self, column, type):
         if type == 'int':
         return self.cnx.insert_id()
 
     def rollback(self):
-        self.cnx.rollback()
-        self.cnx.ping()
+        if self.cnx.ping():
+            self.cnx.rollback()
+        else:
+            self._is_closed = True
+
+    def close(self):
+        if not self._is_closed:
+            self.cnx.close()
+            self._is_closed = True