Fixed#2227: `atomic` supports nesting.
Fixed#6623: `commit_manually` is deprecated and `atomic` doesn't suffer from this defect.
Fixed#8320: the problem wasn't identified, but the legacy transaction management is deprecated.
Fixed#10744: the problem wasn't identified, but the legacy transaction management is deprecated.
Fixed#10813: since autocommit is enabled, it isn't necessary to rollback after errors any more.
Fixed#13742: savepoints are now implemented for SQLite.
Fixed#13870: transaction management in long running processes isn't a problem any more, and it's documented.
Fixed#14970: while it digresses on transaction management, this ticket essentially asks for autocommit on PostgreSQL.
Fixed#15694: `atomic` supports nesting.
Fixed#17887: autocommit makes it impossible for a connection to stay "idle of transaction".
It isn't necessary to disable set_autocommit since its use is prohibited
inside an atomic block. It's still necessary to disable the legacy
transaction management methods for backwards compatibility, until
they're removed.
Replaced them with per-database options, for proper multi-db support.
Also toned down the recommendation to tie transactions to HTTP requests.
Thanks Jeremy for sharing his experience.
Since "unless managed" now means "if database-level autocommit",
committing or rolling back doesn't have any effect.
Restored transactional integrity in a few places that relied on
automatically-started transactions with a transitory API.
For users who didn't activate autocommit in their database options, this
is backwards-incompatible in "non-managed" aka "auto" transaction state.
This state now uses database-level autocommit instead of ORM-level
autocommit.
Also removed the uses_autocommit feature which lost its purpose.
Autocommit cannot be manipulated independently from an open connection.
This commit introduces a minor change in behavior: entering transaction
management forces opening a databasse connection. This shouldn't be
backwards incompatible in any practical use case.
enter_transaction_management() was nearly always followed by managed().
In three places it wasn't, but they will all be refactored eventually.
The "forced" keyword argument avoids introducing behavior changes until
then.
This is mostly backwards-compatible, except, of course, for managed
itself. There's a minor difference in _enter_transaction_management:
the top self.transaction_state now contains the new 'managed' state
rather than the previous one. Django doesn't access
self.transaction_state in _enter_transaction_management.