mirror of
https://github.com/python/cpython.git
synced 2025-11-01 22:21:35 +00:00
gh-93421: Update sqlite3 cursor.rowcount only after SQLITE_DONE (#93526)
This commit is contained in:
parent
5849af7a80
commit
875de61c29
3 changed files with 22 additions and 8 deletions
|
|
@ -898,6 +898,14 @@ def test_rowcount_executemany(self):
|
|||
self.cu.executemany("insert into test(name) values (?)", [(1,), (2,), (3,)])
|
||||
self.assertEqual(self.cu.rowcount, 3)
|
||||
|
||||
@unittest.skipIf(sqlite.sqlite_version_info < (3, 35, 0),
|
||||
"Requires SQLite 3.35.0 or newer")
|
||||
def test_rowcount_update_returning(self):
|
||||
# gh-93421: rowcount is updated correctly for UPDATE...RETURNING queries
|
||||
self.cu.execute("update test set name='bar' where name='foo' returning 1")
|
||||
self.assertEqual(self.cu.fetchone()[0], 1)
|
||||
self.assertEqual(self.cu.rowcount, 1)
|
||||
|
||||
def test_total_changes(self):
|
||||
self.cu.execute("insert into test(name) values ('foo')")
|
||||
self.cu.execute("insert into test(name) values ('foo')")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue