Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactored get_start_transaction_sql() to DatabaseOperations.start_tr…

…ansaction_sql(). Refs #5106

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5965 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 13061bf20bc467c5655c2dfa280dc226a00effcd 1 parent 147e99a
@adrianholovaty adrianholovaty authored
View
6 django/core/management/base.py
@@ -34,9 +34,9 @@ def execute(self, *args, **options):
if output:
if self.output_transaction:
# This needs to be imported here, because it relies on settings.
- from django.db import backend
- if backend.get_start_transaction_sql():
- print self.style.SQL_KEYWORD(backend.get_start_transaction_sql())
+ from django.db import connection
+ if connection.ops.start_transaction_sql():
+ print self.style.SQL_KEYWORD(connection.ops.start_transaction_sql())
print output
if self.output_transaction:
print self.style.SQL_KEYWORD("COMMIT;")
View
6 django/db/backends/__init__.py
@@ -160,3 +160,9 @@ def sequence_reset_sql(self, style, model_list):
color_style() or no_style() in django.core.management.color.
"""
return [] # No sequence reset required by default.
+
+ def start_transaction_sql(self):
+ """
+ Returns the SQL statement required to start a transaction.
+ """
+ return "BEGIN;"
View
3  django/db/backends/ado_mssql/base.py
@@ -103,9 +103,6 @@ def quote_name(name):
dictfetchmany = util.dictfetchmany
dictfetchall = util.dictfetchall
-def get_start_transaction_sql():
- return "BEGIN;"
-
def get_tablespace_sql(tablespace, inline=False):
return "ON %s" % quote_name(tablespace)
View
1  django/db/backends/dummy/base.py
@@ -43,6 +43,5 @@ def close(self):
dictfetchone = complain
dictfetchmany = complain
dictfetchall = complain
-get_start_transaction_sql = complain
OPERATOR_MAPPING = {}
View
3  django/db/backends/mysql/base.py
@@ -188,9 +188,6 @@ def quote_name(name):
dictfetchmany = util.dictfetchmany
dictfetchall = util.dictfetchall
-def get_start_transaction_sql():
- return "BEGIN;"
-
OPERATOR_MAPPING = {
'exact': '= %s',
'iexact': 'LIKE %s',
View
3  django/db/backends/mysql_old/base.py
@@ -207,9 +207,6 @@ def quote_name(name):
dictfetchmany = util.dictfetchmany
dictfetchall = util.dictfetchall
-def get_start_transaction_sql():
- return "BEGIN;"
-
OPERATOR_MAPPING = {
'exact': '= %s',
'iexact': 'LIKE %s',
View
6 django/db/backends/oracle/base.py
@@ -112,6 +112,9 @@ def sequence_reset_sql(self, style, model_list):
'table':f.m2m_db_table()})
return output
+ def start_transaction_sql(self):
+ return ''
+
class DatabaseWrapper(BaseDatabaseWrapper):
ops = DatabaseOperations()
@@ -228,9 +231,6 @@ def get_field_cast_sql(db_type):
else:
return "%s%s"
-def get_start_transaction_sql():
- return None
-
def get_tablespace_sql(tablespace, inline=False):
return "%sTABLESPACE %s" % ((inline and "USING INDEX " or ""), quote_name(tablespace))
View
3  django/db/backends/postgresql/base.py
@@ -211,9 +211,6 @@ def dictfetchall(cursor):
"Returns all rows from a cursor as a dict"
return cursor.dictfetchall()
-def get_start_transaction_sql():
- return "BEGIN;"
-
def typecast_string(s):
"""
Cast all returned strings to unicode strings.
View
3  django/db/backends/postgresql_psycopg2/base.py
@@ -165,9 +165,6 @@ def quote_name(name):
dictfetchmany = util.dictfetchmany
dictfetchall = util.dictfetchall
-def get_start_transaction_sql():
- return "BEGIN;"
-
OPERATOR_MAPPING = {
'exact': '= %s',
'iexact': 'ILIKE %s',
View
3  django/db/backends/sqlite3/base.py
@@ -131,9 +131,6 @@ def _sqlite_extract(lookup_type, dt):
return None
return str(getattr(dt, lookup_type))
-def get_start_transaction_sql():
- return "BEGIN;"
-
def _sqlite_date_trunc(lookup_type, dt):
try:
dt = util.typecast_timestamp(dt)
Please sign in to comment.
Something went wrong with that request. Please try again.