summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-01-08 20:05:43 (GMT)
committerGitHub <noreply@github.com>2022-01-08 20:05:43 (GMT)
commit987fba102e909229dd2aa1a6115aa28d514c1818 (patch)
tree3b53e58327b4978f45b87ab8e0ea382750a880c4
parent8bef658668bac923166ae160c79720aed5f3b712 (diff)
downloadcpython-987fba102e909229dd2aa1a6115aa28d514c1818.zip
cpython-987fba102e909229dd2aa1a6115aa28d514c1818.tar.gz
cpython-987fba102e909229dd2aa1a6115aa28d514c1818.tar.bz2
bpo-46261: Update `sqlite3.Cursor.lastrowid` docs (GH-30407)
-rw-r--r--Doc/library/sqlite3.rst17
1 files changed, 9 insertions, 8 deletions
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst
index f3964b9..1c3bde3 100644
--- a/Doc/library/sqlite3.rst
+++ b/Doc/library/sqlite3.rst
@@ -766,14 +766,15 @@ Cursor Objects
.. attribute:: lastrowid
- This read-only attribute provides the rowid of the last modified row. It is
- only set if you issued an ``INSERT`` or a ``REPLACE`` statement using the
- :meth:`execute` method. For operations other than ``INSERT`` or
- ``REPLACE`` or when :meth:`executemany` is called, :attr:`lastrowid` is
- set to :const:`None`.
-
- If the ``INSERT`` or ``REPLACE`` statement failed to insert the previous
- successful rowid is returned.
+ This read-only attribute provides the row id of the last inserted row. It
+ is only updated after successful ``INSERT`` or ``REPLACE`` statements
+ using the :meth:`execute` method. For other statements, after
+ :meth:`executemany` or :meth:`executescript`, or if the insertion failed,
+ the value of ``lastrowid`` is left unchanged. The initial value of
+ ``lastrowid`` is :const:`None`.
+
+ .. note::
+ Inserts into ``WITHOUT ROWID`` tables are not recorded.
.. versionchanged:: 3.6
Added support for the ``REPLACE`` statement.