Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Moved standard SQL for savepoints in the base backend.

These methods are only called when uses_savepoints = True anyway.
  • Loading branch information...
commit 918f44e3ae650ff124067425d31c9d3deeba2224 1 parent 3bdc7a6
Aymeric Augustin authored February 28, 2013
6  django/db/backends/__init__.py
@@ -863,19 +863,19 @@ def savepoint_create_sql(self, sid):
863 863
         "uses_savepoints" feature is True. The "sid" parameter is a string
864 864
         for the savepoint id.
865 865
         """
866  
-        raise NotImplementedError
  866
+        return "SAVEPOINT %s" % self.quote_name(sid)
867 867
 
868 868
     def savepoint_commit_sql(self, sid):
869 869
         """
870 870
         Returns the SQL for committing the given savepoint.
871 871
         """
872  
-        raise NotImplementedError
  872
+        return "RELEASE SAVEPOINT %s" % self.quote_name(sid)
873 873
 
874 874
     def savepoint_rollback_sql(self, sid):
875 875
         """
876 876
         Returns the SQL for rolling back the given savepoint.
877 877
         """
878  
-        raise NotImplementedError
  878
+        return "ROLLBACK TO SAVEPOINT %s" % self.quote_name(sid)
879 879
 
880 880
     def set_time_zone_sql(self):
881 881
         """
9  django/db/backends/mysql/base.py
@@ -355,15 +355,6 @@ def bulk_insert_sql(self, fields, num_values):
355 355
         items_sql = "(%s)" % ", ".join(["%s"] * len(fields))
356 356
         return "VALUES " + ", ".join([items_sql] * num_values)
357 357
 
358  
-    def savepoint_create_sql(self, sid):
359  
-        return "SAVEPOINT %s" % sid
360  
-
361  
-    def savepoint_commit_sql(self, sid):
362  
-        return "RELEASE SAVEPOINT %s" % sid
363  
-
364  
-    def savepoint_rollback_sql(self, sid):
365  
-        return "ROLLBACK TO SAVEPOINT %s" % sid
366  
-
367 358
 class DatabaseWrapper(BaseDatabaseWrapper):
368 359
     vendor = 'mysql'
369 360
     operators = {
9  django/db/backends/postgresql_psycopg2/operations.py
@@ -175,15 +175,6 @@ def sequence_reset_sql(self, style, model_list):
175 175
                         style.SQL_TABLE(qn(f.m2m_db_table()))))
176 176
         return output
177 177
 
178  
-    def savepoint_create_sql(self, sid):
179  
-        return "SAVEPOINT %s" % sid
180  
-
181  
-    def savepoint_commit_sql(self, sid):
182  
-        return "RELEASE SAVEPOINT %s" % sid
183  
-
184  
-    def savepoint_rollback_sql(self, sid):
185  
-        return "ROLLBACK TO SAVEPOINT %s" % sid
186  
-
187 178
     def prep_for_iexact_query(self, x):
188 179
         return x
189 180
 

0 notes on commit 918f44e

Please sign in to comment.
Something went wrong with that request. Please try again.