From ad6faecc3065e576ca94f365fdcf34f163815781 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Thu, 11 May 2023 10:44:31 +0200 Subject: [PATCH] [3.11] gh-101117: Improve accuracy of sqlite3.Cursor.rowcount docs (#104287) The SQLite C API sqlite3_changes() can only be relied upon when the current active statement has been run to completion. --- Doc/library/sqlite3.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 4dbbfe21ff66c4..249d29ce899364 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -1516,7 +1516,10 @@ Cursor objects ``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` for other statements, including :abbr:`CTE (Common Table Expression)` queries. - It is only updated by the :meth:`execute` and :meth:`executemany` methods. + It is only updated by the :meth:`execute` and :meth:`executemany` methods, + after the statement has run to completion. + This means that any resulting rows must be fetched in order for + :attr:`!rowcount` to be updated. .. attribute:: row_factory