Commits

Germán M. Bravo committed a4204a8

Put execution of commands in savepoints, to survie database errors

  • Participants
  • Parent commits 9707e07

Comments (0)

Files changed (1)

File south/db/generic.py

         get_logger().debug(text_type('execute "%s" with params "%s"' % (sql, params)))
 
         try:
+            sid = transaction.savepoint()
             cursor.execute(sql, params)
         except DatabaseError as e:
+            transaction.savepoint_rollback(sid)
             if print_all_errors:
                 self._print_sql_error(e, sql, params)
             raise
+        finally:
+            transaction.savepoint_commit(sid)
 
         try:
             return cursor.fetchall()