Clarify the meaning of "number of affected rows" in the DB-API 2.0

as discussed on the db-sig list.
This commit is contained in:
Marc-Andre Lemburg 2012-11-06 16:24:07 +01:00
parent 8d1c599b2f
commit 32046dbe54
1 changed files with 3 additions and 17 deletions

View File

@ -1,7 +1,7 @@
PEP: 249
Title: Python Database API Specification v2.0
Version: $Revision$
Last-Modified: $Date$
Version: $Revision: 56119 $
Last-Modified: $Date: 2007-06-28 22:11:32 +0200 (Thu, 28 Jun 2007) $
Author: mal@lemburg.com (Marc-André Lemburg)
Discussions-To: db-sig@python.org
Status: Final
@ -287,7 +287,7 @@ Cursor Objects
This read-only attribute specifies the number of rows that
the last .execute*() produced (for DQL statements like
'select') or affected (for DML statements like 'update' or
'insert'). [9]
'insert').
The attribute is -1 in case no .execute*() has been
performed on the cursor or the rowcount of the last
@ -1127,20 +1127,6 @@ Footnotes
implement the tp_iter slot on the cursor object instead of the
.__iter__() method.
[9] The term "number of affected rows" generally refers to the
number of rows deleted, updated or inserted by the last
statement run on the database cursor. Most databases will
return the total number of rows that were found by the
corresponding WHERE clause of the statement. Some databases
use a different interpretation for UPDATEs and only return the
number of rows that were changed by the UPDATE, even though
the WHERE clause of the statement may have found more matching
rows. Database module authors should try to implement the more
common interpretation of returning the total number of rows
found by the WHERE clause, or clearly document a different
interpretation of the rowcount attribute.
Acknowledgements
Many thanks go to Andrew Kuchling who converted the Python