Skip to content

Commit cc6a391

Browse files
Added a compile time flag to compile SQLite with builtin math functions (#938)
* Added a compile time flag to compile SQLite with builtin math funcions * Added a test, improved the comments in cargo config file
1 parent 33f8205 commit cc6a391

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.cargo/config.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[env]
2+
# To use built-in math functions, this compile time flag must be set
3+
# See https://www.sqlite.org/draft/lang_mathfunc.html as a reference
4+
# According to Cargo docs this will not overwrite any env var that was already
5+
# set by the user, and this is a good thing. If the user already set some
6+
# LIBSQLITE3_FLAGS, he probably knows what he is doing.
7+
LIBSQLITE3_FLAGS = "-DSQLITE_ENABLE_MATH_FUNCTIONS"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set number_three = sqrt(9.0);
2+
3+
select 'text' as component,
4+
case $number_three
5+
when '3.0' then 'It works !'
6+
else 'error: ' || coalesce($number_three, 'NULL')
7+
end AS contents;

0 commit comments

Comments
 (0)