Refactored implementation of savepoints.

Prepared for using savepoints within transactions in autocommit mode.
Added support for savepoints in SQLite.
Implemented an 'atomic' decorator and context manager.

Currently it only works in autocommit mode.

Based on @xact by Christophe Pettus.
Made atomic usable inside the legacy transaction management.
Added some assertions to enforce the atomicity of atomic.
Deprecated the old transaction management APIs.