Repository navigation
Conversation
Expose sqlite3_changes64() (falling back to sqlite3_changes() on SQLite older than 3.37) as a read-only Connection.changes attribute, returning the number of rows modified, inserted, or deleted by the most recently completed INSERT, UPDATE, or DELETE statement. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
📖 3 files modified Preview · build overview · cpython-previews · built Dec. 4, 2026, 4:01 a.m. UTC |
This is a bigmem test then |
Think it's worth having in the code base just to check that the 64 version ran? |
|
Mmh, no |
|
@picnixz updated to use configure instead of inline figuring out availability of the 64 version. Please check again when you get a chance. |
|
A small semantic regression test, independent of the 32/64-bit availability discussion, could distinguish changes from total_changes when triggers write additional rows. For example, create source(id, value) with two rows and an AFTER UPDATE trigger that inserts one audit row per updated source row. After UPDATE source SET value = 1, expect connection.changes == 2 while the total_changes delta is 4 and audit has 2 rows. Then an UPDATE with no matching id should reset changes to 0. This covers both the direct-versus-trigger boundary and the zero-match behavior described in the new docs. I verified those expected values using SELECT changes() on Python 3.12.16 / SQLite 3.53.1, and inspected the getter/tests at 61d1245. SQLite documents that auxiliary trigger changes are excluded: https://www.sqlite.org/c3ref/changes.html. The new Python attribute itself was not executed here, so this is a proposed low-cost contract test, not a PR-build result or a substitute for the 64-bit boundary check. AI assistance was used for the original probe and this write-up. |
Expose sqlite3_changes64() (falling back to sqlite3_changes() on SQLite older than 3.37) as a read-only Connection.changes attribute, returning the number of rows modified, inserted, or deleted by the most recently completed INSERT, UPDATE, or DELETE statement.
As a one-off to test calling the 64 version locally, I created a database with over 2 billion rows (to pass the 32 bit limit) then did
DELETE FROM datato delete the all rows. After that I checked thatconnection.changesdidn't rollover (so the 64 bit version was called). I can't really think of a way to do this test in a CI environment since it used about 20 gigs of RAM and took almost 3 minutes to run once.I figure a one off, with the code review here should be good enough (instead of adding that test with bigmem, etc.)
Connection.changes#163106