diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-03-02 13:47:46 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-03-11 14:48:53 +0100 |
| commit | f5156194945661d217523d6648dfb9b48707ec95 (patch) | |
| tree | 0645efea9da4a6e2aff7c3537cb5d4bcf2fc3117 /django/db/transaction.py | |
| parent | 7aacde84f2b499d9c35741cbfccb621af6b48903 (diff) | |
Added an API to control database-level autocommit.
Diffstat (limited to 'django/db/transaction.py')
| -rw-r--r-- | django/db/transaction.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/django/db/transaction.py b/django/db/transaction.py index 09ce2abbd2..dd48e14bf4 100644 --- a/django/db/transaction.py +++ b/django/db/transaction.py @@ -39,6 +39,18 @@ def get_connection(using=None): using = DEFAULT_DB_ALIAS return connections[using] +def get_autocommit(using=None): + """ + Get the autocommit status of the connection. + """ + return get_connection(using).autocommit + +def set_autocommit(using=None, autocommit=True): + """ + Set the autocommit status of the connection. + """ + return get_connection(using).set_autocommit(autocommit) + def abort(using=None): """ Roll back any ongoing transactions and clean the transaction management |
