BigBrotherBot/big-brother-bot

[SQLITE] cursor.rowcount is not reliable

Closed this issue · 2 comments

I have been experiencing some troubles when creating test cases for the NickregPlugin. The plugin code was using cursor.rowcount to count the number of entries retrieved from the storage, but the cursor.rowcount value was always set to -1, no matter the amount of records retrieved. I fixed the problem using a SELECT COUNT(*)` query but this would need to be investigated: https://docs.python.org/2/library/sqlite3.html#sqlite3.Cursor.rowcount

from that doc it seems the issue is in the implementation of the sqlite lib (on which python has no control, I guess it depends on the operating system sqlite is installed on).
The SELECT COUNT(*) is reliable in all cases, then IMHO we should use it.

My concern is more related to extplugins which are using it (Nickreg was one of them).

Inviato da iPhone

Il giorno 12/giu/2015, alle ore 10:03, Thomas LÉVEIL notifications@github.com ha scritto:

from that doc it seems the issue is in the implementation of the sqlite lib (on which python has no control, I guess it depends on the operating system sqlite is installed on).
The SELECT COUNT(*) is reliable in all cases, then IMHO we should use it.


Reply to this email directly or view it on GitHub.