-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix a bunch of SQLite-related bugs #2866
Commits on Oct 10, 2024
-
Fix SQLITE_MISUSE bug when reusing a prepared statement that previous…
…ly threw. `Query`'s destructor didn't run in this case, so the statement was never reset, and trying to use it again would fail with SQLITE_MISUSE.
Configuration menu - View commit details
-
Copy full SHA for d9ee8c3 - Browse repository at this point
Copy the full SHA d9ee8c3View commit details -
Cleanup: Merge SQLite resetRowCounters() into destroy().
We are doing other per-statement cleanup in `destroy()`, makes sense to reset row counters here too, rather than on the next query constructor.
Configuration menu - View commit details
-
Copy full SHA for b74eb80 - Browse repository at this point
Copy the full SHA b74eb80View commit details -
SQLite: Refactor: prepareSql() returns StatementAndEffect.
This commit has no functional change, but changes prepareSql() to return a struct containing the statement and other information which must be kept with the statement. At present there is no other information, but the next commit will add a description of the statement's effects on the transaction stack. I split this into a separate commit because it's a noisy mechanical change, which I wanted to keep separate from the actual logic change.
Configuration menu - View commit details
-
Copy full SHA for 78b9d98 - Browse repository at this point
Copy the full SHA 78b9d98View commit details -
SQLite: Add SqliteDatabase::onRollback().
This registers a callback which will be called if the current transaction scope ends up being rolled back. We'll need this to fix bugs elsewhere. The implementation requires that we keep track of the transaction stack, which is a bit of a pain. We can discover which statements affect the transaction stack via the authorizor callback.
Configuration menu - View commit details
-
Copy full SHA for 4e349eb - Browse repository at this point
Copy the full SHA 4e349ebView commit details -
SQLite: Fix bug when creation of _cf_KV table is rolled back.
The state of the `SqliteKv` object could get out-of-sync in the case of rollbacks. Our new `onRollback()` function makes this easy to deal with.
Configuration menu - View commit details
-
Copy full SHA for f8ae843 - Browse repository at this point
Copy the full SHA f8ae843View commit details -
SQLite: Fix bug when creation of _cf_METADATA table is rolled back.
Also if cached alarm changes are rolled back. This replaces the previous invalidation mechanism, which did not properly handle `transactionSync()`. The new mechanism handles all rollbacks, so we don't need the old mechanism at all anymore.
Configuration menu - View commit details
-
Copy full SHA for 8da4f7b - Browse repository at this point
Copy the full SHA 8da4f7bView commit details -
SQLite: Throw better exception message when people use BEGIN TRANSACT…
…ION. People mistakenly believed that we didn't support transactions!
Configuration menu - View commit details
-
Copy full SHA for c86b551 - Browse repository at this point
Copy the full SHA c86b551View commit details -
SQLite: Fix missing
RELEASE
of savepoinst intransactionSync()
.`ROLLBACK TO` does not release the savepoint, just rolls back to the point immediately after the savepoint was created. We must additionally release it. This never caused a problem becaues: 1. `transactionSync()` always runs inside an implicit transaction. Committing or rolling back the implicit transaction implicitly releases all the savepoints. 2. It turns out SQLite allows savepoints with the same name as previous ones. The name always refers to the most-recent savepoint by that name which hasn't been released. So, the "leaked" savepoint didn't prevent a new savepoint with the same name from being created later. Note that the async version of `transaction()` does release savepoints properly. I also added a TODO to take advantage of the fact that savepoints can have the same name...
Configuration menu - View commit details
-
Copy full SHA for d34205c - Browse repository at this point
Copy the full SHA d34205cView commit details