Check-in [53782e47e9]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Flesh out the attribution/related works sections a bit.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 53782e47e9dfd3b4bc071b460b0f355c316118d5697cf3fa97a4a13f9f02f85b
User & Date: stephan 2022-10-29 08:10:03.131
Context
2022-10-29
08:21
Clarify a statement about sql.js's history by (somewhat ironically) making it a bit more vague, per feedback on HN. check-in: a66e32996d user: stephan tags: trunk
08:10
Flesh out the attribution/related works sections a bit. check-in: 53782e47e9 user: stephan tags: trunk
08:01
Rename sqlite3.capi.wasm namespace to sqlite3.wasm. That causes a small amount of confusion with the _file_ sqlite3.wasm but seems to make more sense and that namespace effectively reflects that file, anyway. check-in: 60d62005dc user: stephan tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to about.md.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# About the sqlite3 WASM/JS Subproject

[WebAssembly][wasm], a.k.a. WASM, is a standard defining a low-level
programming language suitable (A) as a target for cross-compilation
from many other languages and (B) for running via a virtual machine in
a browser. Designed with scriptability via JavaScript in mind, it
provides a way to compile C code (among others) to WASM and script it
via JavaScript with relatively little friction despite the vast
differences between JavaScript and C.

Folks have been building [sqlite3][sqlite.org] for WASM since [as far
back as
2012](https://github.com/kripken/sql.js/commit/cebd80648dbd369b34804c5a00b4d0bddc1cbf05),
but this subproject is the first effort "officially" associated with
the SQLite project, created with the goal of making WASM builds of the
library first-class members of the family of supported SQLite
deliverables.


## Specific Goals of this Project

The concrete goals of this project include...

- Except where noted in the non-goals, provide a more-or-less











<
<
|
|
|
|







1
2
3
4
5
6
7
8
9
10
11


12
13
14
15
16
17
18
19
20
21
22
# About the sqlite3 WASM/JS Subproject

[WebAssembly][wasm], a.k.a. WASM, is a standard defining a low-level
programming language suitable (A) as a target for cross-compilation
from many other languages and (B) for running via a virtual machine in
a browser. Designed with scriptability via JavaScript in mind, it
provides a way to compile C code (among others) to WASM and script it
via JavaScript with relatively little friction despite the vast
differences between JavaScript and C.

Folks have been building [sqlite3][sqlite.org] for WASM since [as far


back as 2012][sql.js-first] but this subproject is the first effort
"officially" associated with the SQLite project, created with the goal
of making WASM builds of the library first-class members of the family
of supported SQLite deliverables.


## Specific Goals of this Project

The concrete goals of this project include...

- Except where noted in the non-goals, provide a more-or-less
96
97
98
99
100
101
102
103
104
105
106
107



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

131
132
Additionally, Emscripten developers directly offered invaluable
support during the development of [the OPFS-based features][opfs].

## sql.js

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

sql.js was an essential stepping stone in this code's development as
it demonstrates how to handle some of the WASM-related voodoo (like
handling pointers-to-pointers and adding JS implementations of
C-bound callback functions). These APIs have a considerably
different shape than sql.js's, however.




## absurd-sql

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

The aptly-named absurd-sql demonstrates persistent browser-side
sqlite3 by storing the databases in IndexedDB storage. We experimented
with that approach but it's... well, _absurd_ 😉. It's too slow for
anything beyond trivial databases and it's easy to get a database in
an inconsistent state by visiting the page from two tabs.

Even so, it was an interesting experiment.

## wa-sqlite

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

It is likely that wa-sqlite was the first project to provide an OPFS
storage option for sqlite3. It also provides a full demonstration of
how to use the otherwise largely undocumented [OPFS][opfs] APIs.


[wasm]:       https://webassembly.org

[sqlite.org]: https://sqlite.org
[opfs]:       ./persistence.md#opfs







|
|
|
|
|
>
>
>





|
|
|
|
|







|




|
>
|
|
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
Additionally, Emscripten developers directly offered invaluable
support during the development of [the OPFS-based features][opfs].

## sql.js

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

Alon Zakai's `sql.js` was an essential stepping stone in this code's
development as it demonstrates how to handle some of the WASM-related
voodoo (like handling pointers-to-pointers and adding JS
implementations of C-bound callback functions). These APIs have a
considerably different shape than `sql.js`, however.

As far as we're aware, `sql.js` was [the first-ever published use of
sqlite3-via-wasm][sql.js-first].

## absurd-sql

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

James Long's aptly-named `absurd-sql` demonstrates persistent
browser-side sqlite3 by storing the databases in IndexedDB storage. We
experimented with that approach but it's... well, _absurd_ 😉. It's
too slow for anything beyond trivial databases and it's easy to get a
database in an inconsistent state by visiting the page from two tabs.

Even so, it was an interesting experiment.

## wa-sqlite

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

Roy Hashimoto's `wa-sqlite` was the first project to public an OPFS
storage option for sqlite3. It also provides a full demonstration of
how to use the otherwise largely undocumented [OPFS][opfs] APIs.


[wasm]:         https://webassembly.org
[sql.js-first]: https://github.com/kripken/sql.js/commit/cebd80648dbd369b34804c5a00b4d0bddc1cbf05
[sqlite.org]:   https://sqlite.org
[opfs]:         ./persistence.md#opfs
Changes to index.md.
20
21
22
23
24
25
26
27

28
29
30
31






- [**Building sqlite3 WASM**](./building.md) and its associated JS code.
  - [Emscripten](./emscripten.md) build specifics.
- [**Doc and repository maintenance**](./doc-maintenance.md) covers
  details about maintaining the documentation hosted on this site.

Related Works:

- [postgres-wasm](https://supabase.com/blog/postgres-wasm) runs a

  [Postgres database server](https://www.postgresql.org) in a browser.
- Roy Hashimoto's [wa-sqlite](https://github.com/rhashimoto/wa-sqlite)
  may well be the first implementation of [OPFS storage](./persistence.md)
  of sqlite databases.













|
>
|
|


>
>
>
>
>
>
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
- [**Building sqlite3 WASM**](./building.md) and its associated JS code.
  - [Emscripten](./emscripten.md) build specifics.
- [**Doc and repository maintenance**](./doc-maintenance.md) covers
  details about maintaining the documentation hosted on this site.

Related Works:

- Alon Zakai's [**sql.js**](https://github.com/sql-js/sql.js) is the
  first known usage of sqlite3-via-wasm, [dating back to
  2012](https://github.com/kripken/sql.js/commit/cebd80648dbd369b34804c5a00b4d0bddc1cbf05).
- Roy Hashimoto's [**wa-sqlite**](https://github.com/rhashimoto/wa-sqlite)
  may well be the first implementation of [OPFS storage](./persistence.md)
  of sqlite databases.
- James Long's aptly-named
  [**absurd-js**](https://github.com/jlongster/absurd-sql)
  demonstrates storing sqlite3 databases inside IndexedDB databases
  using.
- [**postgres-wasm**](https://supabase.com/blog/postgres-wasm) runs a
  [Postgres database server](https://www.postgresql.org) in a browser.