Fixed rowcount for SELECT statements. They're -1 now (again), for better DB-API 2.0 compliance.

This commit is contained in:
Gerhard Häring 2008-05-31 21:33:27 +00:00
parent 8bfba67101
commit 7f7ca35f5b
3 changed files with 20 additions and 15 deletions

View file

@ -297,6 +297,15 @@ class CursorTests(unittest.TestCase):
self.cu.execute("update test set name='bar'")
self.failUnlessEqual(self.cu.rowcount, 2)
def CheckRowcountSelect(self):
"""
pysqlite does not know the rowcount of SELECT statements, because we
don't fetch all rows after executing the select statement. The rowcount
has thus to be -1.
"""
self.cu.execute("select 5 union select 6")
self.failUnlessEqual(self.cu.rowcount, -1)
def CheckRowcountExecutemany(self):
self.cu.execute("delete from test")
self.cu.executemany("insert into test(name) values (?)", [(1,), (2,), (3,)])