Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c6b9345

Browse files
cjihrigCeres6
authored andcommittedJan 13, 2025
sqlite: enable SQL math functions
This commit enables SQLite math functions. Fixes: nodejs#56435 PR-URL: nodejs#56447 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 94fdb1d commit c6b9345

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed
 

‎deps/sqlite/sqlite.gyp

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
1414
},
1515
'defines': [
16+
'SQLITE_ENABLE_MATH_FUNCTIONS',
1617
'SQLITE_ENABLE_SESSION',
1718
'SQLITE_ENABLE_PREUPDATE_HOOK'
1819
],

‎deps/sqlite/unofficial.gni

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ template("sqlite_gn_build") {
88
config("sqlite_config") {
99
include_dirs = [ "." ]
1010
defines = [
11+
"SQLITE_ENABLE_MATH_FUNCTIONS",
1112
"SQLITE_ENABLE_SESSION",
1213
"SQLITE_ENABLE_PREUPDATE_HOOK",
1314
]

‎test/parallel/test-sqlite.js

+8
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,11 @@ test('PRAGMAs are supported', (t) => {
103103
{ __proto__: null, journal_mode: 'wal' },
104104
);
105105
});
106+
107+
test('math functions are enabled', (t) => {
108+
const db = new DatabaseSync(':memory:');
109+
t.assert.deepStrictEqual(
110+
db.prepare('SELECT PI() AS pi').get(),
111+
{ __proto__: null, pi: 3.141592653589793 },
112+
);
113+
});

0 commit comments

Comments
 (0)
Please sign in to comment.