diff options
author | R. David Murray <rdmurray@bitdance.com> | 2010-06-01 01:32:12 (GMT) |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2010-06-01 01:32:12 (GMT) |
commit | d35251dc19b6f2d1cacbb622a578c81f33d8553a (patch) | |
tree | fd24991f9bc92a4f1360c25647ddb159745a8874 /Doc | |
parent | bcb8d3a0a5d2d7e0d962bd9164ea81128472e21c (diff) | |
download | cpython-d35251dc19b6f2d1cacbb622a578c81f33d8553a.zip cpython-d35251dc19b6f2d1cacbb622a578c81f33d8553a.tar.gz cpython-d35251dc19b6f2d1cacbb622a578c81f33d8553a.tar.bz2 |
#8845: expose sqlite3 inTransaction as RO in_transaction Connection attribute.
Patch by R. David Murray, unit tests by Shashwat Anand.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/sqlite3.rst | 10 | ||||
-rw-r--r-- | Doc/whatsnew/3.2.rst | 12 |
2 files changed, 21 insertions, 1 deletions
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index ad6a641..3db5116 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -227,6 +227,13 @@ Connection Objects one of "DEFERRED", "IMMEDIATE" or "EXCLUSIVE". See section :ref:`sqlite3-controlling-transactions` for a more detailed explanation. +.. attribute:: Connection.in_transaction + + .. versionadded:: 3.2 + + :cont:`True` if a transaction is active (there are uncommitted changes), + :const:`False` otherwise. Read-only attribute. + .. method:: Connection.cursor([cursorClass]) @@ -806,7 +813,8 @@ So if you are within a transaction and issue a command like ``CREATE TABLE before executing that command. There are two reasons for doing that. The first is that some of these commands don't work within transactions. The other reason is that sqlite3 needs to keep track of the transaction state (if a transaction -is active or not). +is active or not). The current transaction state is exposed through the +:attr:`Connection.in_transaction` attribute of the connection object. You can control which kind of ``BEGIN`` statements sqlite3 implicitly executes (or none at all) via the *isolation_level* parameter to the :func:`connect` diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst index e61ad44..265f928 100644 --- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -100,6 +100,18 @@ New, Improved, and Deprecated Modules (Contributed by Tarek Ziade.) +* The *sqlite3* module has some new features: + + * XXX *enable_load_extension* + + * XXX *load_extension* + + * New :class:`~sqlite3.Connection` attribute + :attr:`~sqlite3.Connection.in_transaction` is :const:`True` when there + are uncommitted changes, and :const:`False` otherwise. (Contributed + by R. David Murray and Shashwat Anand, :issue:`8845`.) + + Multi-threading =============== |