Undocumented
Class |
|
Guarantee the atomic execution of a given block. |
Exception |
|
Transaction management is used improperly. |
Function | atomic |
Undocumented |
Function | clean |
Reset the counter used to generate unique savepoint ids in this thread. |
Function | commit |
Commit a transaction. |
Function | get |
Get the autocommit status of the connection. |
Function | get |
Get a database connection by name, or the default database connection if no name is provided. This is a private API. |
Function | get |
Get the "needs rollback" flag -- for *advanced use* only. |
Function | mark |
Internal low-level utility to mark a transaction as "needs rollback" when an exception is raised while not enforcing the enclosed block to be in a transaction. This is needed by Model.save() and friends to avoid starting a transaction when in autocommit mode and a single query is executed. |
Function | non |
Undocumented |
Function | on |
Register `func` to be called when the current transaction is committed. If the current transaction is rolled back, `func` will not be called. |
Function | rollback |
Roll back a transaction. |
Function | savepoint |
Create a savepoint (if supported and required by the backend) inside the current transaction. Return an identifier for the savepoint that will be used for the subsequent rollback or commit. |
Function | savepoint |
Commit the most recent savepoint (if one exists). Do nothing if savepoints are not supported. |
Function | savepoint |
Roll back the most recent savepoint (if one exists). Do nothing if savepoints are not supported. |
Function | set |
Set the autocommit status of the connection. |
Function | set |
Set or unset the "needs rollback" flag -- for *advanced use* only. |
Function | _non |
Undocumented |
Get a database connection by name, or the default database connection if no name is provided. This is a private API.
Internal low-level utility to mark a transaction as "needs rollback" when an exception is raised while not enforcing the enclosed block to be in a transaction. This is needed by Model.save() and friends to avoid starting a transaction when in autocommit mode and a single query is executed. It's equivalent to: connection = get_connection(using) if connection.get_autocommit(): yield else: with transaction.atomic(using=using, savepoint=False): yield but it uses low-level utilities to avoid performance overhead.
Register `func` to be called when the current transaction is committed. If the current transaction is rolled back, `func` will not be called.
Create a savepoint (if supported and required by the backend) inside the current transaction. Return an identifier for the savepoint that will be used for the subsequent rollback or commit.
Set or unset the "needs rollback" flag -- for *advanced use* only. When `rollback` is `True`, trigger a rollback when exiting the innermost enclosing atomic block that has `savepoint=True` (that's the default). Use this to force a rollback without raising an exception. When `rollback` is `False`, prevent such a rollback. Use this only after rolling back to a known-good state! Otherwise, you break the atomic block and data corruption may occur.