Skip to content

Added a compile time flag to compile SQLite with builtin math functions #938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[env]
# To use built-in math functions, this compile time flag must be set
# See https://www.sqlite.org/draft/lang_mathfunc.html as a reference
# According to Cargo docs this will not overwrite any env var that was already
# set by the user, and this is a good thing. If the user already set some
# LIBSQLITE3_FLAGS, he probably knows what he is doing.
LIBSQLITE3_FLAGS = "-DSQLITE_ENABLE_MATH_FUNCTIONS"
7 changes: 7 additions & 0 deletions tests/sql_test_files/it_works_sqrt.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set number_three = sqrt(9.0);

select 'text' as component,
case $number_three
when '3.0' then 'It works !'
else 'error: ' || coalesce($number_three, 'NULL')
end AS contents;
Loading