gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r991577 - in /gump/trunk/python/gump: actor/mysql/databaser.py util/mysql.py
Date Wed, 01 Sep 2010 15:54:51 GMT
Author: bodewig
Date: Wed Sep  1 15:54:51 2010
New Revision: 991577

URL: http://svn.apache.org/viewvc?rev=991577&view=rev
Log:
commit explicitly?

Modified:
    gump/trunk/python/gump/actor/mysql/databaser.py
    gump/trunk/python/gump/util/mysql.py

Modified: gump/trunk/python/gump/actor/mysql/databaser.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/actor/mysql/databaser.py?rev=991577&r1=991576&r2=991577&view=diff
==============================================================================
--- gump/trunk/python/gump/actor/mysql/databaser.py (original)
+++ gump/trunk/python/gump/actor/mysql/databaser.py Wed Sep  1 15:54:51 2010
@@ -65,6 +65,7 @@ class Databaser(gump.core.run.actor.Abst
                 settings['end'] = "'" + _format(module.getEnd()) + "'"
 
             helper.insert('gump_module_run', settings)
+            helper.commit()
 
         finally:
             if helper:
@@ -98,6 +99,7 @@ class Databaser(gump.core.run.actor.Abst
                 settings['end'] = "'" + _format(project.getEnd()) + "'"
 
             helper.insert('gump_project_run', settings)
+            helper.commit()
 
         finally:
             if helper:

Modified: gump/trunk/python/gump/util/mysql.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/util/mysql.py?rev=991577&r1=991576&r2=991577&view=diff
==============================================================================
--- gump/trunk/python/gump/util/mysql.py (original)
+++ gump/trunk/python/gump/util/mysql.py Wed Sep  1 15:54:51 2010
@@ -45,13 +45,15 @@ class Database:
         """
         See PEP 249.
         """
-        pass
+        if self._conn:
+            self._conn.commit()
 
     def rollback(self):
         """
         See PEP 249.
         """
-        pass
+        if self._conn:
+            self._conn.rollback()
 
     def cursor(self):
         """
@@ -119,6 +121,22 @@ class DbHelper:
             self.conn.close()
             self.conn = None
 
+    def commit(self):
+        """
+        Commits the work performed so far
+        """
+        if self.conn:
+            log.info('SQL committing')
+            self.conn.commit()
+
+    def rollback(self):
+        """
+        Rolls back the work performed so far
+        """
+        if self.conn:
+            log.info('SQL rolling back')
+            self.conn.rollback()
+
     def value(self, value):
         """
         Escape and Quote a Value



Mime
View raw message