-
Notifications
You must be signed in to change notification settings - Fork 461
Description
Describe the problem
I'm trying to get math functions to work in sqlite using tauri-plugin-sql on a react-native app. It is necessary to have ln and exp to compute an aggregated product in sqlite.
This requires enabling the build flag SQLITE_ENABLE_MATH_FUNCTIONS, which should actually be enabled by sqlite's ./configure script by default.
Describe the solution you'd like
tauri-plugin-sql uses sqlx, which uses libsqlite3-sys (which weirdly seems to be the same as rusqlite)
rusqlite has the feature flag bundled:
bundledcauses us to automatically compile and link in an up to date
version of SQLite for you. This avoids many common build issues, and
avoids depending on the version of SQLite on the users system (or your
system), which may be old or missing. It's the right choice for most
programs that control their own SQLite databases.
which could be used to set sqlite feature flags like SQLITE_ENABLE_MATH_FUNCTIONS:
It will also honor a LIBSQLITE3_FLAGS variable, which can have a format like "-USQLITE_ALPHA -DSQLITE_BETA SQLITE_GAMMA ...".
Can we reexport the necessary features from rusqlite/libsqlite3-sys via sqlx to tauri?
Alternatives considered
Create a feature flag to let the user link to their own sqlite build.
Similar to sqlx's flag sqlite-unbundled
link SQLite from the system instead of the bundled version.
Allows updating SQLite independently of SQLx or using forked versions.
You must have SQLite installed on the system or provide a path to the library at build time. See [the rusqlite README]> (https://github.com/rusqlite/rusqlite?tab=readme-ov-file#notes-on-building-rusqlite-and-libsqlite3-sys) for details.
May result in link errors if the SQLite version is too old. Version 3.20.0 or newer is recommended.
Can increase build time due to the use of bindgen.