]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-101117: Improve accuracy of sqlite3.Cursor.rowcount docs (#104287)
authorErlend E. Aasland <erlend.aasland@protonmail.com>
Thu, 11 May 2023 08:44:31 +0000 (10:44 +0200)
committerGitHub <noreply@github.com>
Thu, 11 May 2023 08:44:31 +0000 (10:44 +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 89673b8006ae777f833bb9105a80d2c2f6944fbc..e7129fb3e4de6d945e319d933d62dd7421b6149a 100644 (file)
@@ -1694,7 +1694,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