{"repo":"llimllib/wasm_sqlite_with_stats","free":true,"listed":false,"github":"https://github.com/llimllib/wasm_sqlite_with_stats","clone":"git clone https://github.com/llimllib/wasm_sqlite_with_stats.git","description":"Documentation and demonstration of how to build WASM versions of SQLite with extensions embedded","language":"C","stars":29,"topics":["sqlite","wasm","webassembly"],"license":"MIT","category":"databases-storage","readme_excerpt":"Building a WASM sqlite with an embedded extension I wanted to build a wasm version of sqlite, but I also wanted to include an extension in it. As far as I know, you can't dynamically load extensions into the wasm version of sqlite, so I wanted to build a version that had it statically linked in. As I don't know C very well, this seemed pretty hopeless - but thankfully I found sqlite-lines by @asg017 (who also kindly helped me on twitter), which demonstrated that it was possible. - The pieces - The idea - The steps - Build it yourself - SQLite fiddle with extension update (Nov 11 2024): there are official instructions for adding an extension to the official WASM build (this uses sql.js instead, as the official wasm build did not exist at the time of its writing). I have not yet tried them out update 2 (Apr 3 2025): Timothy Lin has a very nice article Giving a thorough example and demonstrating the sqlite3 wasm extra init function which simplifies the process and didn't exist when I wrote this piece. The pieces To build it, I followed in Alex's footsteps and used these pieces: - Emscripten - The sqlite amalgamation file and extension header file - I just copied the versions Alex used - The stats file from sqlean - The sqlite wasm API from sql.js - The Makefile and core-init.c file from sqlite-lines The idea The basic idea of building a sqlite that has an extension statically linked is that you can use an undocumented C preprocessor macro called SQLITE EXTRA INIT which will, if ","default_branch":null,"files":null,"tree":[],"storefront":"/r/llimllib","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/llimllib/wasm_sqlite_with_stats/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}