mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Improved the API of set_autocommit.
This commit is contained in:
parent
f32100939e
commit
e654180ce2
8 changed files with 24 additions and 24 deletions
|
@ -255,7 +255,7 @@ database connection, if you need to.
|
|||
|
||||
.. function:: get_autocommit(using=None)
|
||||
|
||||
.. function:: set_autocommit(using=None, autocommit=True)
|
||||
.. function:: set_autocommit(autocommit, using=None)
|
||||
|
||||
These functions take a ``using`` argument which should be the name of a
|
||||
database. If it isn't provided, Django uses the ``"default"`` database.
|
||||
|
@ -600,11 +600,11 @@ To disable autocommit temporarily, instead of::
|
|||
|
||||
you should now use::
|
||||
|
||||
transaction.set_autocommit(autocommit=False)
|
||||
transaction.set_autocommit(False)
|
||||
try:
|
||||
# do stuff
|
||||
finally:
|
||||
transaction.set_autocommit(autocommit=True)
|
||||
transaction.set_autocommit(True)
|
||||
|
||||
To enable autocommit temporarily, instead of::
|
||||
|
||||
|
@ -613,11 +613,11 @@ To enable autocommit temporarily, instead of::
|
|||
|
||||
you should now use::
|
||||
|
||||
transaction.set_autocommit(autocommit=True)
|
||||
transaction.set_autocommit(True)
|
||||
try:
|
||||
# do stuff
|
||||
finally:
|
||||
transaction.set_autocommit(autocommit=False)
|
||||
transaction.set_autocommit(False)
|
||||
|
||||
Disabling transaction management
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue