Loading django/db/backends/__init__.py +14 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ class BaseDatabaseWrapper(object): self.savepoint_state = 0 # Transaction management related attributes self.autocommit = False self.transaction_state = [] # Tracks if the connection is believed to be in transaction. This is # set somewhat aggressively, as the DBAPI doesn't make it easy to Loading Loading @@ -232,6 +233,12 @@ class BaseDatabaseWrapper(object): """ pass def _set_autocommit(self, autocommit): """ Backend-specific implementation to enable or disable autocommit. """ raise NotImplementedError ##### Generic transaction management methods ##### def enter_transaction_management(self, managed=True, forced=False): Loading Loading @@ -274,6 +281,13 @@ class BaseDatabaseWrapper(object): raise TransactionManagementError( "Transaction managed block ended with pending COMMIT/ROLLBACK") def set_autocommit(self, autocommit=True): """ Enable or disable autocommit. """ self._set_autocommit(autocommit) self.autocommit = autocommit def abort(self): """ Roll back any ongoing transaction and clean the transaction state Loading django/db/backends/creation.py +5 −1 Original line number Diff line number Diff line import hashlib import sys import time import warnings from django.conf import settings from django.db.utils import load_backend Loading Loading @@ -466,7 +467,10 @@ class BaseDatabaseCreation(object): anymore by Django code. Kept for compatibility with user code that might use it. """ pass warnings.warn( "set_autocommit was moved from BaseDatabaseCreation to " "BaseDatabaseWrapper.", PendingDeprecationWarning, stacklevel=2) return self.connection.set_autocommit() def _prepare_for_test_db_ddl(self): """ Loading django/db/backends/dummy/base.py +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): _savepoint_rollback = ignore _enter_transaction_management = complain _leave_transaction_management = ignore _set_autocommit = complain set_dirty = complain set_clean = complain commit_unless_managed = complain Loading django/db/backends/mysql/base.py +3 −0 Original line number Diff line number Diff line Loading @@ -445,6 +445,9 @@ class DatabaseWrapper(BaseDatabaseWrapper): except Database.NotSupportedError: pass def _set_autocommit(self, autocommit): self.connection.autocommit(autocommit) def disable_constraint_checking(self): """ Disables foreign key checks, primarily for use in adding rows with forward references. Always returns True, Loading django/db/backends/oracle/base.py +3 −0 Original line number Diff line number Diff line Loading @@ -612,6 +612,9 @@ class DatabaseWrapper(BaseDatabaseWrapper): def _savepoint_commit(self, sid): pass def _set_autocommit(self, autocommit): self.connection.autocommit = autocommit def check_constraints(self, table_names=None): """ To check constraints, we set constraints to immediate. Then, when, we're done we must ensure they Loading Loading
django/db/backends/__init__.py +14 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ class BaseDatabaseWrapper(object): self.savepoint_state = 0 # Transaction management related attributes self.autocommit = False self.transaction_state = [] # Tracks if the connection is believed to be in transaction. This is # set somewhat aggressively, as the DBAPI doesn't make it easy to Loading Loading @@ -232,6 +233,12 @@ class BaseDatabaseWrapper(object): """ pass def _set_autocommit(self, autocommit): """ Backend-specific implementation to enable or disable autocommit. """ raise NotImplementedError ##### Generic transaction management methods ##### def enter_transaction_management(self, managed=True, forced=False): Loading Loading @@ -274,6 +281,13 @@ class BaseDatabaseWrapper(object): raise TransactionManagementError( "Transaction managed block ended with pending COMMIT/ROLLBACK") def set_autocommit(self, autocommit=True): """ Enable or disable autocommit. """ self._set_autocommit(autocommit) self.autocommit = autocommit def abort(self): """ Roll back any ongoing transaction and clean the transaction state Loading
django/db/backends/creation.py +5 −1 Original line number Diff line number Diff line import hashlib import sys import time import warnings from django.conf import settings from django.db.utils import load_backend Loading Loading @@ -466,7 +467,10 @@ class BaseDatabaseCreation(object): anymore by Django code. Kept for compatibility with user code that might use it. """ pass warnings.warn( "set_autocommit was moved from BaseDatabaseCreation to " "BaseDatabaseWrapper.", PendingDeprecationWarning, stacklevel=2) return self.connection.set_autocommit() def _prepare_for_test_db_ddl(self): """ Loading
django/db/backends/dummy/base.py +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): _savepoint_rollback = ignore _enter_transaction_management = complain _leave_transaction_management = ignore _set_autocommit = complain set_dirty = complain set_clean = complain commit_unless_managed = complain Loading
django/db/backends/mysql/base.py +3 −0 Original line number Diff line number Diff line Loading @@ -445,6 +445,9 @@ class DatabaseWrapper(BaseDatabaseWrapper): except Database.NotSupportedError: pass def _set_autocommit(self, autocommit): self.connection.autocommit(autocommit) def disable_constraint_checking(self): """ Disables foreign key checks, primarily for use in adding rows with forward references. Always returns True, Loading
django/db/backends/oracle/base.py +3 −0 Original line number Diff line number Diff line Loading @@ -612,6 +612,9 @@ class DatabaseWrapper(BaseDatabaseWrapper): def _savepoint_commit(self, sid): pass def _set_autocommit(self, autocommit): self.connection.autocommit = autocommit def check_constraints(self, table_names=None): """ To check constraints, we set constraints to immediate. Then, when, we're done we must ensure they Loading