Skip to content

Commit

Permalink
[3.11] pythongh-101117: Improve accuracy of sqlite3.Cursor.rowcount d…
Browse files Browse the repository at this point in the history
…ocs (python#104287)

The SQLite C API sqlite3_changes() can only be relied upon when the
current active statement has been run to completion.
  • Loading branch information
erlend-aasland committed May 11, 2023
1 parent 846a23d commit ad6faec
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Doc/library/sqlite3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ad6faec

Please sign in to comment.