SQLite Forum

sqlite-wasm: Issue with wrapped worker using multiple databases
Login

sqlite-wasm: Issue with wrapped worker using multiple databases

(1) By Daniel Rose (modiho) on 2023-12-12 17:38:01 [source]

Hello,

I ran into an issue with sqlite-wasm that I was able to solve with two small changes to the sqlite3Worker1Promiser implementation.

To summarise, calls to the promiser will always use the dbId that is returned from the first open, and not the one given by the caller. This prevents a program from sending commands to different databases, as the commands are always executed on the database that was opened first.

You can find a minimal reproduction here, and a commit that fixes the issue for me here. The commit description contains a more detailed explanation of the problem and the proposed solution (For anyone who wants to try out the fix using the linked repo, note that the changes will be overwritten by npm install).

Is this something that should be fixed upstream?

Thank you, Daniel

(2) By Stephan Beal (stephan) on 2023-12-12 17:44:03 in reply to 1 [link] [source]

Is this something that should be fixed upstream?

Most definitely. They'll be integrated within the next day.

Thank you for the report and the fix!