-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Feature: SQLite-for-WASM support #3994
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
base: main
Are you sure you want to change the base?
Conversation
I've been attempting to test this PR out. It believe its crashing when unwrapping the call to The error is: I believe it may be due to the use of a thread in It's possible |
This change
adds a new featureDetects when the target is WASM, which, when enabled, replacessqlite-wasm
libsqlite3-sys
withsqlite-wasm-rs
.It is a new database driver (in the sense that thesqlite-wasm
feature should replace thesqlite
feature, unlikesqlite-unbundled
)But it is also not new, since no new APIs were created
Does your PR solve an issue?
fixes #2985
Is this a breaking change?
No, as the new database driver:sqlite-wasm
is only activated with the new feature, and without it, no dependencies or APIs are changed. (Except for the fact that some versions inCargo.lock
were modified, which I have no idea how to stop)Edit: it now uses
sqlite-wasm-rs
when the target iswasm
. This changes the behavior of compiling sqlx with sqlite on WASM from "compilation error" to "success". I don't think this is a breaking changeProblem 1
SQLite-WASM does not support
load-extension
, which is included in the default configuration for sqlite. There are multiple ways to solve this:sqlite-load-extension
cause a build error on WASM, but keep it turned on by defaultsqlite-wasm
, which decreases the inconveniencesqlite-load-extension
cause a build error on WASM and remove it from the defaultssqlite-load-extension
cause a build error on WASM, but only when explicitly chosen, with the default being silently ignoredProblem 2
The sqlite version used for compile-time checking (the system one) is different from the sqlite version used at runtime (WASM). This isn't actually a big problem, because the same already happens when using
sqlite-unbundled
Todo
sqlite-wasm-rs
andlibsqlite3-sys
are identical (to be fair I don't really know)Oh no
sqlite-wasm-rs
features