]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-101117: Improve accuracy of sqlite3.Cursor.rowcount docs (#104287) (#104381)
authorErlend E. Aasland <erlend.aasland@protonmail.com>
Thu, 11 May 2023 09:09:46 +0000 (11:09 +0200)
committerGitHub <noreply@github.com>
Thu, 11 May 2023 09:09:46 +0000 (11:09 +0200)
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

index 4dbbfe21ff66c42eb37bb85278ed6df98bb552e8..249d29ce89936487ffd7063bafdb520ee4fa2bc9 100644 (file)
@@ -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