summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-03-07 14:05:32 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-03-11 15:04:10 +0100
commitffe41591e75fc3acf76c634bdd0899d78e91688d (patch)
tree907cf7141bdffb04a4ed21c2d463abb6ee56a051
parent557e40412729c06a2daff34a4cabcb6efb719b32 (diff)
Updated the documentation for savepoints.
Apparently django.db.transaction used to be an object.
-rw-r--r--docs/topics/db/transactions.txt26
1 files changed, 17 insertions, 9 deletions
diff --git a/docs/topics/db/transactions.txt b/docs/topics/db/transactions.txt
index 37a369a02f..bcedd90424 100644
--- a/docs/topics/db/transactions.txt
+++ b/docs/topics/db/transactions.txt
@@ -193,24 +193,32 @@ Each of these functions takes a ``using`` argument which should be the name of
a database for which the behavior applies. If no ``using`` argument is
provided then the ``"default"`` database is used.
-Savepoints are controlled by three methods on the transaction object:
+Savepoints are controlled by three functions in :mod:`django.db.transaction`:
-.. method:: transaction.savepoint(using=None)
+.. function:: savepoint(using=None)
Creates a new savepoint. This marks a point in the transaction that
is known to be in a "good" state.
- Returns the savepoint ID (sid).
+ Returns the savepoint ID (``sid``).
-.. method:: transaction.savepoint_commit(sid, using=None)
+.. function:: savepoint_commit(sid, using=None)
- Updates the savepoint to include any operations that have been performed
- since the savepoint was created, or since the last commit.
+ Releases savepoint ``sid``. The changes performed since the savepoint was
+ created become part of the transaction.
-.. method:: transaction.savepoint_rollback(sid, using=None)
+.. function:: savepoint_rollback(sid, using=None)
- Rolls the transaction back to the last point at which the savepoint was
- committed.
+ Rolls back the transaction to savepoint ``sid``.
+
+These functions do nothing if savepoints aren't supported or if the database
+is in autocommit mode.
+
+In addition, there's a utility function:
+
+.. function:: clean_savepoints(using=None)
+
+ Resets the counter used to generate unique savepoint IDs.
The following example demonstrates the use of savepoints::