gh-93925: Improve clarity of sqlite3 commit/rollback, and close docs (#93926)

Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
This commit is contained in:
Erlend Egeberg Aasland 2022-06-19 21:17:28 +02:00 committed by GitHub
parent 62363bfe59
commit 6446592c89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 19 deletions

View file

@ -423,21 +423,20 @@ Connection Objects
.. method:: commit()
This method commits the current transaction. If you don't call this method,
anything you did since the last call to ``commit()`` is not visible from
other database connections. If you wonder why you don't see the data you've
written to the database, please check you didn't forget to call this method.
Commit any pending transaction to the database.
If there is no open transaction, this method is a no-op.
.. method:: rollback()
This method rolls back any changes to the database since the last call to
:meth:`commit`.
Roll back to the start of any pending transaction.
If there is no open transaction, this method is a no-op.
.. method:: close()
This closes the database connection. Note that this does not automatically
call :meth:`commit`. If you just close your database connection without
calling :meth:`commit` first, your changes will be lost!
Close the database connection.
Any pending transaction is not committed implicitly;
make sure to :meth:`commit` before closing
to avoid losing pending changes.
.. method:: execute(sql[, parameters])