Update sqlite3_web, simplify #115
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This updates
package:sqlite3_webto version0.4.0. That version comes with a few new features, most notably:readwrite-unsafeas an opening mode when opening sync file handles, multiple tabs can open the same database concurrently.sqlite3_webwill internally guard concurrent access with web locks to avoid contention on the file (since we still can't implementxLocksynchronously).sqlite3_webneeds locks for 1, those are now exposed in its API too. So, instead of using a custom protocol for lock management, we can just usesqlite3_webAPIs here.autocommitstate checks: This package used to rely on custom requests for statements in transactions to verify theautocommitstate before running statements in the transaction. Version0.4.0makes this simpler, since:checkInTransaction: trueto makesqlite3_webreject the statement if the database is not in a transaction.These features allow deleting a fair bit of logic here since we have that in
slqite3_webnow.With these changes, new users on Chrome would get an OPFS database (it used to be IndexedDB before unless COOP + COEP headers were enabled):
There are checks in
sqlite3_webensuring that an IndexedDB database would be re-used if it exists.