summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/connection.c
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2022-06-19 19:17:28 (GMT)
committerGitHub <noreply@github.com>2022-06-19 19:17:28 (GMT)
commit6446592c89b0c581c00e170ae6278291e940755c (patch)
tree6a301d09b06a64cd58142710c02d2f091277b764 /Modules/_sqlite/connection.c
parent62363bfe59b236c324cf36cd69b6f586a125bc2b (diff)
downloadcpython-6446592c89b0c581c00e170ae6278291e940755c.zip
cpython-6446592c89b0c581c00e170ae6278291e940755c.tar.gz
cpython-6446592c89b0c581c00e170ae6278291e940755c.tar.bz2
gh-93925: Improve clarity of sqlite3 commit/rollback, and close docs (#93926)
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
Diffstat (limited to 'Modules/_sqlite/connection.c')
-rw-r--r--Modules/_sqlite/connection.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index f0e6a56..b6b7417 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -470,12 +470,14 @@ error:
/*[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;
@@ -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;
@@ -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;