mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
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:
parent
62363bfe59
commit
6446592c89
3 changed files with 30 additions and 19 deletions
|
@ -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])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue