gh-99824: Document that sqlite3.connect implicitly open a transaction if autocommit=False (#99825)

Authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
This commit is contained in:
Géry Ogam 2022-11-30 12:33:50 +01:00 committed by GitHub
parent fe17d35313
commit 19c38801ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2468,9 +2468,9 @@ which implies :pep:`249`-compliant transaction control.
This means: This means:
* :mod:`!sqlite3` ensures that a transaction is always open, * :mod:`!sqlite3` ensures that a transaction is always open,
so :meth:`Connection.commit` and :meth:`Connection.rollback` so :func:`connect`, :meth:`Connection.commit`, and :meth:`Connection.rollback`
will implicitly open a new transaction immediately after closing will implicitly open a new transaction
the pending one. (immediately after closing the pending one, for the latter two).
:mod:`!sqlite3` uses ``BEGIN DEFERRED`` statements when opening transactions. :mod:`!sqlite3` uses ``BEGIN DEFERRED`` statements when opening transactions.
* Transactions should be committed explicitly using :meth:`!commit`. * Transactions should be committed explicitly using :meth:`!commit`.
* Transactions should be rolled back explicitly using :meth:`!rollback`. * Transactions should be rolled back explicitly using :meth:`!rollback`.