diff options
author | stephan <stephan@noemail.net> | 2022-09-21 19:51:25 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2022-09-21 19:51:25 +0000 |
commit | 6110a5d0ab229b40627d09b4118801fca71bc941 (patch) | |
tree | 150e4eb3cfaced01d664d772fcf6e06b13088c11 /ext/wasm/api/sqlite3-wasm.c | |
parent | 65022716b349c82870f13a9004dc6b1071ddfe7d (diff) | |
download | sqlite-6110a5d0ab229b40627d09b4118801fca71bc941.tar.gz sqlite-6110a5d0ab229b40627d09b4118801fca71bc941.zip |
Put pieces in place for fiddle to support opfs, but more cleanup is required in the sqlite3.js/fiddle connection. bigIntEnabled now defaults to whether the Emscripten's module has bigint enabled. Add wasm-sensible defaults for several SQLITE_ENABLE/OMIT flags in sqlite3-wasm.c.
FossilOrigin-Name: 7c7fb7535e86b3960eea7f29ab7e6d5197c166b4ee64ad4a9bc0749f2869badc
Diffstat (limited to 'ext/wasm/api/sqlite3-wasm.c')
-rw-r--r-- | ext/wasm/api/sqlite3-wasm.c | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/ext/wasm/api/sqlite3-wasm.c b/ext/wasm/api/sqlite3-wasm.c index 5b127cb74..e1e5be248 100644 --- a/ext/wasm/api/sqlite3-wasm.c +++ b/ext/wasm/api/sqlite3-wasm.c @@ -1,11 +1,44 @@ /* ** This file requires access to sqlite3.c static state in order to -** implement certain WASM-specific features. Unlike the rest of -** sqlite3.c, this file requires compiling with -std=c99 (or -** equivalent, or a later C version) because it makes use of features -** not available in C89. +** implement certain WASM-specific features, and thus directly +** includes that file. Unlike the rest of sqlite3.c, this file +** requires compiling with -std=c99 (or equivalent, or a later C +** version) because it makes use of features not available in C89. +** +** At it's simplest, to build sqlite3.wasm either place this file +** in the same directory as sqlite3.c/h before compilation or use the +** -I/path flag to tell the compiler where to find both of those +** files, then compile this file. For example: +** +** emcc -o sqlite3.wasm ... -I/path/to/sqlite3-c-and-h sqlite3-wasm.c */ -#include "sqlite3.c" + +#ifndef SQLITE_DEFAULT_UNIX_VFS +# define SQLITE_DEFAULT_UNIX_VFS "unix-none" +#endif +#ifndef SQLITE_OMIT_DEPRECATED +# define SQLITE_OMIT_DEPRECATED +#endif +#ifndef SQLITE_OMIT_LOAD_EXTENSION +# define SQLITE_OMIT_LOAD_EXTENSION +#endif +#ifndef SQLITE_OMIT_SHARED_CACHE +# define SQLITE_OMIT_SHARED_CACHE +#endif +#ifndef SQLITE_OMIT_UTF16 +# define SQLITE_OMIT_UTF16 +#endif +#ifndef SQLITE_OS_KV_OPTIONAL +# define SQLITE_OS_KV_OPTIONAL 1 +#endif +#ifndef SQLITE_TEMP_STORE +# define SQLITE_TEMP_STORE 3 +#endif +#ifndef SQLITE_THREADSAFE +# define SQLITE_THREADSAFE 0 +#endif + +#include "sqlite3.c" /* yes, .c instead of .h. */ /* ** WASM_KEEP is identical to EMSCRIPTEN_KEEPALIVE but is not |