]> granicus.if.org Git - python/commitdiff
Fix errors in sqlite3's Cursor.rowcount documentation
authorPetri Lehtinen <petri@digip.org>
Thu, 16 Feb 2012 19:42:34 +0000 (21:42 +0200)
committerPetri Lehtinen <petri@digip.org>
Thu, 16 Feb 2012 19:42:34 +0000 (21:42 +0200)
Closes #13995.

Doc/includes/sqlite3/shortcut_methods.py
Doc/library/sqlite3.rst
Misc/NEWS

index 72ed4b3712c805e3e4239f82d3a92c2c1a4353ac..e128a3bf606a77070951c953dd7ffc2585b7aab1 100644 (file)
@@ -17,5 +17,4 @@ con.executemany("insert into person(firstname, lastname) values (?, ?)", persons
 for row in con.execute("select firstname, lastname from person"):
     print row
 
-# Using a dummy WHERE clause to not let SQLite take the shortcut table deletes.
-print "I just deleted", con.execute("delete from person where 1=1").rowcount, "rows"
+print "I just deleted", con.execute("delete from person").rowcount, "rows"
index 051ac92ca7b45a46c103409387154df7831fd985..80803aa3518dfb69dd66e83ab5f2fd826938d66b 100644 (file)
@@ -548,18 +548,17 @@ Cursor Objects
    attribute, the database engine's own support for the determination of "rows
    affected"/"rows selected" is quirky.
 
-   For ``DELETE`` statements, SQLite reports :attr:`rowcount` as 0 if you make a
-   ``DELETE FROM table`` without any condition.
-
    For :meth:`executemany` statements, the number of modifications are summed up
    into :attr:`rowcount`.
 
    As required by the Python DB API Spec, the :attr:`rowcount` attribute "is -1 in
    case no ``executeXX()`` has been performed on the cursor or the rowcount of the
-   last operation is not determinable by the interface".
+   last operation is not determinable by the interface". This includes ``SELECT``
+   statements because we cannot determine the number of rows a query produced
+   until all rows were fetched.
 
-   This includes ``SELECT`` statements because we cannot determine the number of
-   rows a query produced until all rows were fetched.
+   With SQLite versions before 3.6.5, :attr:`rowcount` is set to 0 if
+   you make a ``DELETE FROM table`` without any condition.
 
 .. attribute:: Cursor.lastrowid
 
index 4ae21b6ee2d16bc45e30ac88ea97c7ce663220dd..1b1d02c6faa1b8e55ece42acc993bc9dae32091d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -575,6 +575,8 @@ Tests
 Documentation
 -------------
 
+- Issue #13995: Fix errors in sqlite3's Cursor.rowcount documentation
+
 - Issue #13402: Document absoluteness of sys.executable.
 
 - Issue #13883: PYTHONCASEOK also works on OS X, OS/2, and RiscOS.