15 Commits
Author SHA1 Message Date
Guilherme Araújo f2b698f1cf sqlite: rename DatabaseSync and StatementSync
Rename the DatabaseSync and StatementSync classes to Database and
Statement, and the internal DatabaseSyncLimits helper to
DatabaseLimits. The old names are kept as aliases of the new classes
and are Documentation-only deprecated (DEP0210, DEP0211).

Assisted-by: Claude Code
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65988
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2026-09-26 00:03:45 +00:00
Paul Bouchon 500d0482df test: prefer in-memory databases in sqlite tests
Several SQLite tests created temporary file databases through a
`nextDb()` helper even though they only exercise SQL behavior and never
rely on filesystem persistence. Switch those to `:memory:`, which is
faster and drops the temporary-file bookkeeping. Tests that depend on an
on-disk or shared database keep using files: the constructor, open() and
backup() cases, the timeout and cross-worker suites, and the WAL
journal-mode PRAGMA.

Refs: https://github.com/nodejs/node/issues/64665
Signed-off-by: Paul Bouchon <mail@bitpshr.net>
PR-URL: https://github.com/nodejs/node/pull/64701
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2026-08-04 15:03:13 +00:00
Jurj Andrei George 637bda0238 sqlite: enable Percentile extension
PR-URL: https://github.com/nodejs/node/pull/61295
Refs: https://github.com/nodejs/node/issues/60618
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2026-01-18 13:07:14 +00:00
Bart Louwers d2ff9daf58 sqlite: fix crash session extension callbacks with workers
PR-URL: https://github.com/nodejs/node/pull/59848
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
2025-09-23 14:41:39 +00:00
Michael Dawson 535c2f7562 sqlite: add build option to build without sqlite
Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: https://github.com/nodejs/node/pull/58122
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-05-07 17:20:57 -04:00
Edy Silva 9aa57bf8da sqlite: enable common flags
PR-URL: https://github.com/nodejs/node/pull/57621
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-04-04 16:57:43 +00:00
Edy Silva c7cf6778c7 sqlite,test,doc: allow Buffer and URL as database location
PR-URL: https://github.com/nodejs/node/pull/56991
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-02-27 17:43:13 +00:00
Colin Ihrig 338d70b752 sqlite: enable SQL math functions
This commit enables SQLite math functions.

Fixes: https://github.com/nodejs/node/issues/56435
PR-URL: https://github.com/nodejs/node/pull/56447
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-01-05 05:35:54 +00:00
Edigleysson Silva (Edy) a73c41c51e sqlite: aggregate constants in a single property
PR-URL: https://github.com/nodejs/node/pull/56213
Fixes: https://github.com/nodejs/node/issues/56193
Refs: https://github.com/nodejs/node/issues/56193
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2024-12-17 17:36:58 +00:00
Colin Ihrig 1d01ad6773 doc,lib,src,test: unflag sqlite module
This commit allows the node:sqlite module to be used without
starting Node with a CLI flag. The module is still experimental.

Fixes: https://github.com/nodejs/node/issues/55854
PR-URL: https://github.com/nodejs/node/pull/55890
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2024-11-19 03:23:18 +00:00
Michaël Zasso 7fea0108d5 sqlite: return results with null prototype
These objects are dictionaries, and a query can return columns with
special names like `__proto__` (which would be ignored without this
change).

Also construct the object by passing vectors of properties for better
performance and improve error handling by using `MaybeLocal`.

PR-URL: https://github.com/nodejs/node/pull/54350
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2024-08-25 10:43:17 +00:00
cjihrig 916865ba8b sqlite: split up large test file
The original test/parallel/test-sqlite.js test appears to time
out in the CI occasionally. This commit splits the test into
several smaller test files.

Fixes: https://github.com/nodejs/node/issues/54006
PR-URL: https://github.com/nodejs/node/pull/54014
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2024-08-12 13:48:28 +00:00
Deokjin Kim db594d042b src: return undefined if no rows are returned in SQLite
For now, { key: null, value: null} is returned even though
no rows are returned from database when `statement.get()`
is called. So return empty value if return value of
`sqlite3_step` is `SQLITE_DONE`.

PR-URL: https://github.com/nodejs/node/pull/53981
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2024-07-23 16:34:59 +00:00
Tobias Nießen ad0a2db975 src,test: disallow unsafe integer coercion in SQLite
Currently, by default (i.e., when use_big_ints_ has not explicitly been
set to true), reading a SQLite integer value that is not a safe integer
in JavaScript is likely to yield an incorrect number.

Instead, err on the side of caution and throw if the stored integer is
not a safe integer in JavaScript and if use_big_ints_ has not been set
to true.

PR-URL: https://github.com/nodejs/node/pull/53851
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2024-07-22 12:22:17 +00:00
Colin Ihrig b4e8f1b6bb lib,src,test,doc: add node:sqlite module
PR-URL: https://github.com/nodejs/node/pull/53752
Fixes: https://github.com/nodejs/node/issues/53264
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2024-07-09 20:33:38 +00:00