* Proof-of-concept pre-built custom sql.js * Rewrite Makefile as a couple of comprehensible Python scripts * Add link to a blog post about transitive closure in SQLite * Remove eval extension -- no much point as it only returns a string * Consistently use existing Path objects * Add basic tests scalar functions from extension-functions.c * Test presence of functions from the rest of built extensions * Use the same sqlite.com domain * Add a couple SQLite compile flags that may make it a bit faster * Add regexpi function test * Add node about regexpi and REGEXP operator * Workaround first build failure, rebuild lock file and minor fixes
SQLite WebAssembly build
This directory contains Docker-based build script, make.sh, that builds
a custom version of sql.js. It allows sqliteviz to have more recent
version of SQLite build with a number of useful extensions.
Makefile from sql.js is rewritten as more comprehensible configure.py
and build.py Python scripts that run in emscripten/emsdk Docker container.
Extension
SQLite amalgamation extensions included:
- FTS5 -- virtual table module that provides full-text search functionality
SQLite miscellaneous extensions included:
generate_seriestable-valued series function (series.c)transitive_closurevirtual table for Querying Tree Structures in SQLite (closure.c)uuid,uuid_stranduuid_blobRFC-4122 UUID functions (uuid.c)regexp(henceREGEXPoperator) andregexpifunctions (regexp.c)
SQLite 3rd party extensions included:
- pivot_vtab -- a pivot virtual table
To ease the step to have working clone locally, the build is committed into the repository.
Build method
Basically it's extended amalgamation and SQLITE_EXTRA_INIT concisely
described in this message from SQLite Forum:
Simply append it to the end of the amalgamation file. The real problem is how you get the init function called. The easiest way (to me at any rate) is to append a function (after the extensions you want to add are all appended) that adds the init function for each extension to the auto extension list for new connections, and set the pre-processor symbol SQLITE_EXTRA_INIT to the name of this function. [...]
An example
SQLITE_EXTRA_INITfunction looks like this:int core_init(const char* dummy) { int nErr = 0; nErr += sqlite3_auto_extension((void*)sqlite3_autobusy_init); nErr += sqlite3_auto_extension((void*)sqlite3_ipaddress_init); return nErr ? SQLITE_ERROR : SQLITE_OK; }so you would then define
SQLITE_EXTRA_INIT=core_initwhen compiling the amalgamation code and the extensions would thereafter be automatically initialized on each connection.