Skip to content

Commit

Permalink
sqlite: enable SQL math functions
Browse files Browse the repository at this point in the history
This commit enables SQLite math functions.

Fixes: #56435
PR-URL: #56447
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
cjihrig authored Jan 5, 2025
1 parent d0ff34f commit 338d70b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions deps/sqlite/sqlite.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
},
'defines': [
'SQLITE_ENABLE_MATH_FUNCTIONS',
'SQLITE_ENABLE_SESSION',
'SQLITE_ENABLE_PREUPDATE_HOOK'
],
Expand Down
1 change: 1 addition & 0 deletions deps/sqlite/unofficial.gni
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ template("sqlite_gn_build") {
config("sqlite_config") {
include_dirs = [ "." ]
defines = [
"SQLITE_ENABLE_MATH_FUNCTIONS",
"SQLITE_ENABLE_SESSION",
"SQLITE_ENABLE_PREUPDATE_HOOK",
]
Expand Down
8 changes: 8 additions & 0 deletions test/parallel/test-sqlite.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,11 @@ test('PRAGMAs are supported', (t) => {
{ __proto__: null, journal_mode: 'wal' },
);
});

test('math functions are enabled', (t) => {
const db = new DatabaseSync(':memory:');
t.assert.deepStrictEqual(
db.prepare('SELECT PI() AS pi').get(),
{ __proto__: null, pi: 3.141592653589793 },
);
});

0 comments on commit 338d70b

Please sign in to comment.