mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-93421: Update sqlite3 cursor.rowcount only after SQLITE_DONE (GH-93526)
(cherry picked from commit 875de61c29
)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
This commit is contained in:
parent
121ab58e03
commit
68aae80159
3 changed files with 22 additions and 8 deletions
|
@ -903,6 +903,14 @@ class CursorTests(unittest.TestCase):
|
|||
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