Re: How to interpret the cursor.rowcount?

Andrew McNamara <[email protected]>
Newsgroups gmane.comp.python.sybase
Message-ID <[email protected]>
>In fact, I DO the execute before. in any case, i will extract a small
>test case and post it on the list. In the mean time I will continue with
>0.36pre6.

Reading your message again (more carefully this time), I agree with you -
I would have expected it to return 0 for a query returning no rows. Dave?

>On Mon, 2003-05-26 at 02:00, Andrew McNamara wrote:
>> >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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.