Skip to content

Commit

Permalink
build: Include various useful extensions in our built SQLite
Browse files Browse the repository at this point in the history
It's the same list of extensions we use in our macOS nightly
builds currently:

  * COLUMN_METADATA
  * FTS3
  * FTS3_PARENTHESIS
  * FTS5
  * GEOPOLY
  * JSON1
  * MATH_FUNCTIONS
  * RTREE
  * SOUNDEX
  * STAT4

This commit doesn't add the function names to the SQLite Authorizer
white list, which can come later.  Live databases should be able to
use them immediately however.
  • Loading branch information
justinclift committed Apr 24, 2023
1 parent 081bbd9 commit d1f469c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions build_dbhub.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/sh

# TODO: Consider adding the same extensions to the SQLite compile here, that we use
# in our macOS, AppImage (etc) builds. Then add the function names to the allowed
# list for the API Query() function
# TODO: Add the function names from the SQLite extensions to AuthorizerSelect()

# Useful variables
DEST=${PWD}/local
Expand Down Expand Up @@ -42,7 +40,7 @@ if [ ! -e "${DEST}/lib/libsqlite3.so" ]; then
echo "Compiling local SQLite"
tar xfz sqlite.tar.gz
cd sqlite-autoconf-* || exit 4
./configure --prefix=${DEST} --enable-dynamic-extensions=no
CPPFLAGS="-DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_MAX_VARIABLE_NUMBER=250000 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_STAT4=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1 -DSQLITE_MAX_ATTACHED=125 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 -DSQLITE_ENABLE_SNAPSHOT=1" ./configure --prefix=${DEST} --enable-dynamic-extensions=no
make -j9
make install
cd ..
Expand Down

1 comment on commit d1f469c

@justinclift
Copy link
Member Author

@justinclift justinclift commented on d1f469c Apr 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking through the function names inside these extensions, the soundex and json ones are already whitelisted so are usable with standard databases already.

The COLUMN_METADATA extension seems like it'll probably be useless for our purposes here, as it doesn't enable any new SQL functions for users, and doesn't do anything our Go SQLite driver cares about. Oh well. 😉

Several of the other extensions (FTS5, R*Tree) needed some adjustment to work even with Live databases. That's now all done, and running in production.

Please sign in to comment.