diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..d22ed76a --- /dev/null +++ b/.cargo/config.toml @@ -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" diff --git a/tests/sql_test_files/it_works_sqrt.sql b/tests/sql_test_files/it_works_sqrt.sql new file mode 100644 index 00000000..99c92383 --- /dev/null +++ b/tests/sql_test_files/it_works_sqrt.sql @@ -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;