From: Erlend Egeberg Aasland Date: Sat, 8 Jan 2022 19:17:09 +0000 (+0100) Subject: bpo-46261: Update `sqlite3.Cursor.lastrowid` docs (GH-30407) X-Git-Tag: v3.11.0a4~47 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b6aa38f1ca79600f2ab46ac114ff36461a19c4a3;p=thirdparty%2FPython%2Fcpython.git bpo-46261: Update `sqlite3.Cursor.lastrowid` docs (GH-30407) --- diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index fb38182370ea..415a5f9a9290 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -845,14 +845,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.