[python-sybase] How to interpret the cursor.rowcount?

Andrew McNamara andrewm at object-craft.com.au
Mon, 26 May 2003 10:00:03 +1000


>In particular, when a query does not return any matching
>row, the versions up to 0.36pre6 set the value of
>cursor.rowcount to 0 (what I really expected it to be).
>With 0.36, the value becomes -1.

I would guess it's been done to improve compliance with the Python
Database API Specification 2.0, which has the following to say about
rowcount:

    This read-only attribute specifies the number of rows that the last
    executeXXX() produced (for DQL statements like select) or affected
    (for DML statements like update or insert).

    The attribute is -1 in case no executeXXX() has been performed on
    the cursor or the rowcount of the last operation is not determinable
    by the interface.[7]

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/