Movatterモバイル変換


[0]ホーム

URL:


About the sqlite3 WASM/JS Subproject

WebAssembly, a.k.a. WASM, is a standard defining a low-levelprogramming language suitable (A) as a target for cross-compilationfrom many other languages and (B) for running via a virtual machine ina browser. Designed with scriptability via JavaScript in mind, itprovides a way to compile C code (among others) to WASM and script itvia JavaScript with relatively little friction despite the vastdifferences between JavaScript and C.

Folks have been buildingsqlite3 for the web sinceasfar back as 2012 but this subproject is the firsteffort "officially" associated with the SQLite project, created withthe goal of making WASM builds of the library first-class members ofthe family of supported SQLite deliverables.

Specific Goals of this Project

The concrete goals of this project include...

Specific Non-goals

Things we specifically donot aim to achieve:

Attribution

Several projects have helped us considerably along the way. We aregreatly indebted to (in the order we investigated them)...

Emscripten

https://emscripten.org

The Emscripten WASM toolchain is, as of this writing, the onlyfull-featured WASM toolchain available. Though other toolchains exist,Emscripten offers several "killer features" which others do not, mostnotably transparent emulation of POSIX file I/O APIs, which allowssqlite3 to function as-is in a WASM build, with no changes or tweakingnecessary.

Additionally, Emscripten developers directly offered invaluablesupport during the development ofthe OPFS-based features.

sql.js

https://github.com/sql-js/sql.js

Alon Zakai'ssql.js was an essential stepping stone in this code'sdevelopment as it demonstrates how to handle some of the WASM-relatedvoodoo (like handling pointers-to-pointers and adding JSimplementations of C-bound callback functions). These APIs have aconsiderably different shape thansql.js, however.

As far as we're aware,sql.js wasthe first-ever published use ofsqlite3 for the web.

absurd-sql

https://github.com/jlongster/absurd-sql

James Long'sabsurd-sql demonstrates persistent browser-side SQLitedatabases by storing the databases in IndexedDB storage. Weexperimented with that approach but it didn't suit us. Even so, it wasan interesting experiment.

wa-sqlite

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

Roy Hashimoto'swa-sqlite was the first project to publish an OPFSstorage option for sqlite3. His ongoing work in SQLite VFSes has beena continual source of inspiration.


[8]ページ先頭

©2009-2025 Movatter.jp