Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
gh-93925: Improve doc clarity of sqlite3 commit/rollback, and close
  • Loading branch information
@erlend-aasland
erlend-aasland committedJun 17, 2022
commitffefedfdb59a0592664ee21b3a33dac82629cb57
17 changes: 8 additions & 9 deletionsDoc/library/sqlite3.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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 rollsbackany changesto thedatabase since the last call to
:meth:`commit`.
Rollback to thestart 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 loosing pending changes.

.. method:: execute(sql[, parameters])

Expand Down
14 changes: 10 additions & 4 deletionsModules/_sqlite/clinic/connection.c.h
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

18 changes: 12 additions & 6 deletionsModules/_sqlite/connection.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -470,12 +470,14 @@ blobopen_impl(pysqlite_Connection *self, const char *table, const char *col,
/*[clinic input]
_sqlite3.Connection.close as pysqlite_connection_close

Closes the connection.
Close the database connection.

Any pending transaction is not committed implicitly.
[clinic start generated code]*/

static PyObject *
pysqlite_connection_close_impl(pysqlite_Connection *self)
/*[clinic end generated code: output=a546a0da212c9b97 input=3d58064bbffaa3d3]*/
/*[clinic end generated code: output=a546a0da212c9b97 input=b3ed5b74f6fefc06]*/
{
if (!pysqlite_check_thread(self)) {
return NULL;
Expand DownExpand Up@@ -522,12 +524,14 @@ int pysqlite_check_connection(pysqlite_Connection* con)
/*[clinic input]
_sqlite3.Connection.commit as pysqlite_connection_commit

Commit the current transaction.
Commit any pending transaction to the database.

If there is no open transaction, this method is a no-op.
[clinic start generated code]*/

static PyObject *
pysqlite_connection_commit_impl(pysqlite_Connection *self)
/*[clinic end generated code: output=3da45579e89407f2 input=39c12c04dda276a8]*/
/*[clinic end generated code: output=3da45579e89407f2 input=c8793c97c3446065]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
Expand DownExpand Up@@ -557,12 +561,14 @@ pysqlite_connection_commit_impl(pysqlite_Connection *self)
/*[clinic input]
_sqlite3.Connection.rollback as pysqlite_connection_rollback

Roll back the current transaction.
Roll back to the start of any pending transaction.

If there is no open transaction, this method is a no-op.
[clinic start generated code]*/

static PyObject *
pysqlite_connection_rollback_impl(pysqlite_Connection *self)
/*[clinic end generated code: output=b66fa0d43e7ef305 input=12d4e8d068942830]*/
/*[clinic end generated code: output=b66fa0d43e7ef305 input=7f60a2f1076f16b3]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp