diff options
author | Petri Lehtinen <petri@digip.org> | 2012-02-16 19:42:34 (GMT) |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2012-02-16 19:42:34 (GMT) |
commit | 002b202009e5d887f6ff075e428319849cfd865b (patch) | |
tree | 04a03426c6315d7f55fa448672e62e8b53797b57 | |
parent | 14dc510395aa2469f0d86664202681735d2b63a0 (diff) | |
download | cpython-002b202009e5d887f6ff075e428319849cfd865b.zip cpython-002b202009e5d887f6ff075e428319849cfd865b.tar.gz cpython-002b202009e5d887f6ff075e428319849cfd865b.tar.bz2 |
Fix errors in sqlite3's Cursor.rowcount documentation
Closes #13995.
-rw-r--r-- | Doc/includes/sqlite3/shortcut_methods.py | 3 | ||||
-rw-r--r-- | Doc/library/sqlite3.rst | 11 | ||||
-rw-r--r-- | Misc/NEWS | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/Doc/includes/sqlite3/shortcut_methods.py b/Doc/includes/sqlite3/shortcut_methods.py index 72ed4b3..e128a3b 100644 --- a/Doc/includes/sqlite3/shortcut_methods.py +++ b/Doc/includes/sqlite3/shortcut_methods.py @@ -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" diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 051ac92..80803aa 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -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 @@ -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. |