Repository navigation
Conversation
export() closes and reopens the database, and the new connection had no update hook, so changes made after an export were no longer reported, while updateHookFunctionPtr still pointed to the old callback.
Member
|
Thank you for bringing this to my attention ! I think the clean fix is to use the dedicated https://sqlite.org/c3ref/serialize.html instead of closing the database entirely. I'll open a different PR. |
Contributor
Author
|
Makes sense: with |
lovasoa
added a commit
that referenced
this pull request
Oct 26, 2026
Use SQLite's backup API to fill a single preallocated JS-owned export buffer without closing the source connection or allocating a database-sized WASM snapshot. Preserve callbacks, statements, connection settings and transaction state; reject active write transactions without rolling them back. Add export regression coverage and prepare version 1.15.2. Supersedes #642 and #643. Validated by full CI on all WebAssembly variants.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Database.export()closes the connection and opens a new one. The update hook was registered on the old connection only, so after an export no more changes were reported.updateHookFunctionPtrstill pointed to the old callback, so nothing showed that the hook had been dropped:export()now registers the existing callback on the reopened connection, the same way it already registers the extension functions again (#565). CallingupdateHook(null)afterwards still removes it, because that call now acts on the new connection.Test: one more step at the end of
test/test_update_hook.js: export, insert a row, and expect theinsertcall.Testing note: Emscripten is not installed on the machine this was prepared on, so the bundles were not rebuilt with
npm run build. Instead, thesrc/api.jstext inside the published 1.15.1 debug bundles (sql-wasm-debug.js,sql-wasm-inline-debug.jsand theirworker.versions) was replaced with the patched file. Those bundles containsrc/api.jsat fa1f0c1 verbatim. The test runner was then run against them:node test/all.js wasm-debugandnode test/all.js wasm-inline-debug->FAIL test update_hook("keep the update hook after an export"),Passed:27 Failed:1node test/all.js wasm-debugandnode test/all.js wasm-inline-debug->Passed:28 Failed:0npx eslint .passesThe optimized
wasm,wasm-browserandwasm-inlinebundles were not rebuilt, so the fullnpm test(includingtest/builds.js) was not run with the change.