mirror of
https://github.com/python/cpython.git
synced 2025-07-30 14:44:10 +00:00
Fixed rowcount for SELECT statements. They're -1 now (again), for better DB-API 2.0 compliance.
This commit is contained in:
parent
8bfba67101
commit
7f7ca35f5b
3 changed files with 20 additions and 15 deletions
|
@ -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,)])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue