Added support for savepoints in SQLite.

Technically speaking they aren't usable yet.
Implemented an 'atomic' decorator and context manager.

Currently it only works in autocommit mode.

Based on @xact by Christophe Pettus.
Added some assertions to enforce the atomicity of atomic.
Made transaction management work even before the first SQL query.

Thanks Florian again.
Implemented atomic_if_autocommit.

It disables transaction management entirely when AUTOCOMMIT is False.
Deprecated TransactionMiddleware and TRANSACTIONS_MANAGED.

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.
Re-ordered functions by deprecation status.
Updated the documentation for savepoints.

Apparently django.db.transaction used to be an object.
Added an explanation of transactions and grouped low-level APIs.
Added a note about long-running processes.

There isn't much else to say, really.
Added an option to disable the creation of savepoints in atomic.
Added a safety net for developers messing with autocommit.
Updated a test that doesn't make sense with autocommit.
Removed a test that no longer makes any sense.

Since unmanaged == autocommit, there's nothing to commit or roll back.
Used commit_on_success_unless_managed to make ORM operations atomic.
Used commit_on_success_unless_managed in loaddata.
Abused atomic for transaction handling in TestCase.

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.
Improved the API of set_autocommit.
Merged branch 'database-level-autocommit'.

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".
Fixed loaddata command, broken in the previous merge.