Ensure that the row count for queries is reset to zero when the statement is

executed (https://github.com/oracle/python-cx_Oracle/issues/193).
This commit is contained in:
Anthony Tuininga 2018-06-25 15:57:19 -06:00
parent a8751e91f4
commit fb249f5944
2 changed files with 17 additions and 1 deletions

2
odpi

@ -1 +1 @@
Subproject commit c54f6d92bbd7cfe13dcb01ffe85ff6c05370c488
Subproject commit fee0c54fdbba51cbb12287d236196cf333de5360

View File

@ -573,3 +573,19 @@ class TestCursor(BaseTestCase):
self.assertEqual(count, 0)
self.assertRaises(cx_Oracle.InterfaceError, self.cursor.close)
def testQueryRowCount(self):
"test that the rowcount attribute is reset to zero on query execute"
sql = "select * from dual where 1 = :s"
self.cursor.execute(sql, [0])
self.cursor.fetchone()
self.assertEqual(self.cursor.rowcount, 0)
self.cursor.execute(sql, [1])
self.cursor.fetchone()
self.assertEqual(self.cursor.rowcount, 1)
self.cursor.execute(sql, [1])
self.cursor.fetchone()
self.assertEqual(self.cursor.rowcount, 1)
self.cursor.execute(sql, [0])
self.cursor.fetchone()
self.assertEqual(self.cursor.rowcount, 0)