Skip to content

Commit 86b8170

Browse files
sqlite: enable Percentile extension
1 parent 2030fd3 commit 86b8170

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

deps/sqlite/sqlite.gyp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
'SQLITE_ENABLE_FTS5',
2222
'SQLITE_ENABLE_GEOPOLY',
2323
'SQLITE_ENABLE_MATH_FUNCTIONS',
24+
'SQLITE_ENABLE_PERCENTILE',
2425
'SQLITE_ENABLE_PREUPDATE_HOOK',
2526
'SQLITE_ENABLE_RBU',
2627
'SQLITE_ENABLE_RTREE',

deps/sqlite/unofficial.gni

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ template("sqlite_gn_build") {
1515
"SQLITE_ENABLE_FTS5",
1616
"SQLITE_ENABLE_GEOPOLY",
1717
"SQLITE_ENABLE_MATH_FUNCTIONS",
18+
"SQLITE_ENABLE_PERCENTILE",
1819
"SQLITE_ENABLE_PREUPDATE_HOOK",
1920
"SQLITE_ENABLE_RBU",
2021
"SQLITE_ENABLE_RTREE",

test/parallel/test-sqlite.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,19 @@ suite('SQL APIs enabled at build time', () => {
204204
);
205205
});
206206

207+
test('percentile is enabled', (t) => {
208+
const db = new DatabaseSync(':memory:');
209+
db.exec(`
210+
CREATE TABLE t1 (x INTEGER);
211+
INSERT INTO t1 (x) VALUES (1), (2), (3), (4), (5);
212+
`);
213+
214+
t.assert.deepStrictEqual(
215+
db.prepare('SELECT percentile(x, 50) AS p50 FROM t1;').get(),
216+
{ __proto__: null, p50: 3 },
217+
);
218+
});
219+
207220
test('dbstat is enabled', (t) => {
208221
const db = new DatabaseSync(nextDb());
209222
t.after(() => { db.close(); });
@@ -244,7 +257,7 @@ suite('SQL APIs enabled at build time', () => {
244257
);
245258
});
246259

247-
test('fts3 parenthesis', (t) => {
260+
test('fts3 parenthesis is enabled', (t) => {
248261
const db = new DatabaseSync(':memory:');
249262
db.exec(`
250263
CREATE VIRTUAL TABLE t1 USING fts3(content TEXT);

0 commit comments

Comments
 (0)