From 918f44e3ae650ff124067425d31c9d3deeba2224 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Thu, 28 Feb 2013 18:30:03 +0100 Subject: [PATCH] Moved standard SQL for savepoints in the base backend. These methods are only called when uses_savepoints = True anyway. --- django/db/backends/__init__.py | 6 +++--- django/db/backends/mysql/base.py | 9 --------- django/db/backends/postgresql_psycopg2/operations.py | 9 --------- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index 499bc321130..95a7bdc3b9e 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -863,19 +863,19 @@ class BaseDatabaseOperations(object): "uses_savepoints" feature is True. The "sid" parameter is a string for the savepoint id. """ - raise NotImplementedError + return "SAVEPOINT %s" % self.quote_name(sid) def savepoint_commit_sql(self, sid): """ Returns the SQL for committing the given savepoint. """ - raise NotImplementedError + return "RELEASE SAVEPOINT %s" % self.quote_name(sid) def savepoint_rollback_sql(self, sid): """ Returns the SQL for rolling back the given savepoint. """ - raise NotImplementedError + return "ROLLBACK TO SAVEPOINT %s" % self.quote_name(sid) def set_time_zone_sql(self): """ diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index 39fd3695b7c..f7d07cf4b76 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -355,15 +355,6 @@ class DatabaseOperations(BaseDatabaseOperations): items_sql = "(%s)" % ", ".join(["%s"] * len(fields)) return "VALUES " + ", ".join([items_sql] * num_values) - def savepoint_create_sql(self, sid): - return "SAVEPOINT %s" % sid - - def savepoint_commit_sql(self, sid): - return "RELEASE SAVEPOINT %s" % sid - - def savepoint_rollback_sql(self, sid): - return "ROLLBACK TO SAVEPOINT %s" % sid - class DatabaseWrapper(BaseDatabaseWrapper): vendor = 'mysql' operators = { diff --git a/django/db/backends/postgresql_psycopg2/operations.py b/django/db/backends/postgresql_psycopg2/operations.py index 56535e08650..a210f87ccd1 100644 --- a/django/db/backends/postgresql_psycopg2/operations.py +++ b/django/db/backends/postgresql_psycopg2/operations.py @@ -175,15 +175,6 @@ class DatabaseOperations(BaseDatabaseOperations): style.SQL_TABLE(qn(f.m2m_db_table())))) return output - def savepoint_create_sql(self, sid): - return "SAVEPOINT %s" % sid - - def savepoint_commit_sql(self, sid): - return "RELEASE SAVEPOINT %s" % sid - - def savepoint_rollback_sql(self, sid): - return "ROLLBACK TO SAVEPOINT %s" % sid - def prep_for_iexact_query(self, x): return x