Hey all -

Had a user today confused about the word "affected", when we describe the 
definition of cursor.rowcount.  Per pep-249:

.rowcount 
          
            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').

So as many of you know, MySQL has actually two options for how rowcount can be 
reported.  It can report the number of rows "found", that is, matched by the 
WHERE criterion of an UPDATE or DELETE statement, or it can report the number 
of rows that were actually updated or deleted, and here we're talking about an 
UPDATE that may or may not have had a net change in row value.   The Python 
MySQL drivers tend to default to the latter.    Every other database/DBAPI I've 
worked with only offers the former.

Question is, is there an intent behind the term "affected" here?   

If it is intentionally vague, could there be some more explicit phrasing to 
that effect, "by 'affected' we mean whatever the underlying driver interprets 
this to mean" or something along those lines ?  Or if it really means, "number 
of rows matched", should the word "affected" be altered here ?

Thanks for reading.






_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
http://mail.python.org/mailman/listinfo/db-sig

Reply via email to