News for hackers. Stuff that matters.
Re:Sqlite3 WebAssembly by brandonpollack2 on Tuesday October 15, 2024 @02:53PM (#41851864)
I was trying to get this working in a rust ecosystem some time ago but none of the blessed.rs sql (rusqlite, sqlx) wrappers seem to take advantage of it yet and wrapping it yourself is a bit tricky since when I was trying I couldn't figure out a way to to get emscripten wasm code to play nice with wasm32-unknown-unknown without some kind of JS wrapper which then requires implementing the interface those crates expect and exposing it from JS. Once that is done in rust itll be great there too!
Re:Sqlite3 WebAssembly by tonygiorgio on Tuesday October 15, 2024 @03:15PM (#41852082)
Yeah I’ve been waiting awhile for this myself. A few PRs with work pending for a year or so. I’ve seen some proof of concepts but nothing anywhere close to usable.
Re:Sqlite3 WebAssembly by insipx on Tuesday October 15, 2024 @07:41PM (#41854235)
you should check out https://github.com/xmtp/diesel-wasm-sqlite

reliable so far, being dogfooded in production as we speak

Re:Sqlite3 WebAssembly by tonygiorgio on Tuesday October 22, 2024 @10:52AM (#41914875)
Sorry just saw this. Looks promising, I love diesel! Haven’t looked at the landscape in a few months and don’t work on the project that needed it anymore but very cool to see. Even uses OPFS!
Re:Sqlite3 WebAssembly by aabhay on Tuesday October 15, 2024 @04:53PM (#41852996)
I have been working on one. If you're interested in working on it or contributing, feel free to chime in here:

https://github.com/rhashimoto/wa-sqlite/discussions/154

This essentially requires that we import the sqlite emscripten build via an extern C header in wasm bindgen, and then we need to re-implement the VFS in rust while compiling it in multi-threaded mode to allow for shared array buffer access. After that is all done, we will be able to access SQLite rows as raw wasm bytes. That gives us the ability to implement a rust-sqlite style wrapper or integration. There would still not be some of the niceties such as connection pooling, but in wasm you likely want to use the db in exclusive mode.

Re:Sqlite3 WebAssembly by insipx on Tuesday October 15, 2024 @05:08PM (#41853144)
Got this SQLite build working with rusts diesel sqlite here: https://github.com/xmtp/diesel-wasm-sqlite

I'm gearing up for a 0.2 release this week which should iron out a few kinks, but otherwise you can use the diesel ORM as if its native

Re:Sqlite3 WebAssembly by azakai on Tuesday October 15, 2024 @08:59PM (#41854660)
> I couldn't figure out a way to to get emscripten wasm code to play nice with wasm32-unknown-unknown

There is good news there, some people plan to get Emscripten and Rust to work well together in Wasm:

https://github.com/rustwasm/wasm-bindgen/pull/4014#issuecomm...