Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 17f1be6

Browse files
committed
Merge branch '3.2'
Closes #13995.
2 parents 8e3926a + b389022 commit 17f1be6

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

Doc/includes/sqlite3/shortcut_methods.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@
1717
for row in con.execute("select firstname, lastname from person"):
1818
print(row)
1919

20-
# Using a dummy WHERE clause to not let SQLite take the shortcut table deletes.
21-
print("I just deleted", con.execute("delete from person where 1=1").rowcount, "rows")
20+
print("I just deleted", con.execute("delete from person").rowcount, "rows")

Doc/library/sqlite3.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -555,18 +555,17 @@ Cursor Objects
555555
attribute, the database engine's own support for the determination of "rows
556556
affected"/"rows selected" is quirky.
557557

558-
For ``DELETE`` statements, SQLite reports :attr:`rowcount` as 0 if you make a
559-
``DELETE FROM table`` without any condition.
560-
561558
For :meth:`executemany` statements, the number of modifications are summed up
562559
into :attr:`rowcount`.
563560

564561
As required by the Python DB API Spec, the :attr:`rowcount` attribute "is -1 in
565562
case no ``executeXX()`` has been performed on the cursor or the rowcount of the
566-
last operation is not determinable by the interface".
563+
last operation is not determinable by the interface". This includes ``SELECT``
564+
statements because we cannot determine the number of rows a query produced
565+
until all rows were fetched.
567566

568-
This includes ``SELECT`` statements because we cannot determine the number of
569-
rows a query produced until all rows were fetched.
567+
With SQLite versions before 3.6.5, :attr:`rowcount` is set to 0 if
568+
you make a ``DELETE FROM table`` without any condition.
570569

571570
.. attribute:: Cursor.lastrowid
572571

Misc/NEWS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2258,8 +2258,8 @@ C-API
22582258
Documentation
22592259
-------------
22602260

2261-
- Issue #13491: Fix many errors in sqlite3 documentation. Initial
2262-
patch by Johannes Vogel.
2261+
- Issues #13491 and #13995: Fix many errors in sqlite3 documentation.
2262+
Initial patch for #13491 by Johannes Vogel.
22632263

22642264
- Issue #13402: Document absoluteness of sys.executable.
22652265

0 commit comments

Comments
 (0)