Skip to content

Commit f2b698f

Browse files
authored
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: #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>
1 parent 9c06dab commit f2b698f

42 files changed

Lines changed: 1013 additions & 983 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎SECURITY.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,14 +430,14 @@ the community they pose.
430430

431431
* Examples of scenarios that are **not** Node.js vulnerabilities:
432432
* Allowing untrusted users to register SQLite user-defined functions via
433-
`node:sqlite` (`DatabaseSync`) that can perform arbitrary operations
433+
`node:sqlite` (`Database`) that can perform arbitrary operations
434434
(e.g., closing database connections during query execution, causing crashes
435435
or use-after-free conditions).
436436
* Loading SQLite extensions using the `allowExtension` option in
437-
`DatabaseSync` — this option must be explicitly set to `true` by the
437+
`Database` — this option must be explicitly set to `true` by the
438438
application, and enabling it is the application operator's responsibility.
439439
* Using `node:sqlite` built-in SQL functions or pragmas (e.g.,
440-
`ATTACH DATABASE`) to read or write files — `DatabaseSync` operates with
440+
`ATTACH DATABASE`) to read or write files — `Database` operates with
441441
the same file-system access as the process itself, and it is the
442442
application's responsibility to restrict what SQL is executed.
443443
* Exposing `child_process.exec()` or similar APIs to untrusted users without
@@ -532,7 +532,7 @@ The following are **not** vulnerabilities in Node.js:
532532
access. Inconsistent checks on these paths are treated as regular bugs and
533533
should be reported through the public issue tracker.
534534

535-
* **`node:sqlite` and the permission model**: `DatabaseSync` operates with the
535+
* **`node:sqlite` and the permission model**: `Database` operates with the
536536
same file-system privileges as the process. Using SQL pragmas or built-in
537537
SQLite mechanisms (e.g., `ATTACH DATABASE`) to access files does not bypass
538538
the permission model — the permission model does not intercept SQL-level

‎benchmark/sqlite/sqlite-diagnostic-channel.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, {
1212
function main(conf) {
1313
const { n, mode } = conf;
1414

15-
const db = new sqlite.DatabaseSync(':memory:');
15+
const db = new sqlite.Database(':memory:');
1616
db.exec('CREATE TABLE t (x INTEGER)');
1717
const insert = db.prepare('INSERT INTO t VALUES (?)');
1818

‎benchmark/sqlite/sqlite-is-transaction.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const bench = common.createBenchmark(main, {
99
});
1010

1111
function main(conf) {
12-
const db = new sqlite.DatabaseSync(':memory:');
12+
const db = new sqlite.Database(':memory:');
1313

1414
if (conf.transaction === 'true') {
1515
db.exec('BEGIN');

‎benchmark/sqlite/sqlite-prepare-insert.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const bench = common.createBenchmark(main, {
1717
});
1818

1919
function main(conf) {
20-
const db = new sqlite.DatabaseSync(':memory:');
20+
const db = new sqlite.Database(':memory:');
2121

2222
db.exec('CREATE TABLE text_column_type (text_column TEXT)');
2323
db.exec('CREATE TABLE integer_column_type (integer_column INTEGER)');

‎benchmark/sqlite/sqlite-prepare-select-all-options.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function main(conf) {
1919
return acc;
2020
}, {});
2121

22-
const db = new sqlite.DatabaseSync(':memory:', optionsObj);
22+
const db = new sqlite.Database(':memory:', optionsObj);
2323

2424
db.exec(
2525
'CREATE TABLE foo (text_column TEXT, integer_column INTEGER, real_column REAL, blob_column BLOB)',

‎benchmark/sqlite/sqlite-prepare-select-all.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const bench = common.createBenchmark(main, {
2424
});
2525

2626
function main(conf) {
27-
const db = new sqlite.DatabaseSync(':memory:');
27+
const db = new sqlite.Database(':memory:');
2828

2929
// Create only the necessary table for the benchmark type.
3030
// If the statement includes 'foo_large', create the foo_large table; otherwise, create the foo table.

‎benchmark/sqlite/sqlite-prepare-select-get-options.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function main(conf) {
1818
return acc;
1919
}, {});
2020

21-
const db = new sqlite.DatabaseSync(':memory:', optionsObj);
21+
const db = new sqlite.Database(':memory:', optionsObj);
2222

2323
db.exec(
2424
'CREATE TABLE foo (text_column TEXT, integer_column INTEGER, real_column REAL, blob_column BLOB)',

‎benchmark/sqlite/sqlite-prepare-select-get.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const bench = common.createBenchmark(main, {
1818
});
1919

2020
function main(conf) {
21-
const db = new sqlite.DatabaseSync(':memory:');
21+
const db = new sqlite.Database(':memory:');
2222

2323
// Create only the necessary table for the benchmark type.
2424
// If the statement includes 'foo_large', create the foo_large table; otherwise, create the foo table.

‎doc/api/deprecations.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4801,6 +4801,34 @@ async function example() {
48014801
}
48024802
```
48034803
4804+
### DEP0210: `sqlite.DatabaseSync`
4805+
4806+
<!-- YAML
4807+
changes:
4808+
- version: REPLACEME
4809+
pr-url: https://github.com/nodejs/node/pull/65988
4810+
description: Documentation-only deprecation.
4811+
-->
4812+
4813+
Type: Documentation-only
4814+
4815+
`node:sqlite`'s `DatabaseSync` class was renamed to `Database`. `DatabaseSync`
4816+
is kept as a deprecated alias. Use `Database` instead.
4817+
4818+
### DEP0211: `sqlite.StatementSync`
4819+
4820+
<!-- YAML
4821+
changes:
4822+
- version: REPLACEME
4823+
pr-url: https://github.com/nodejs/node/pull/65988
4824+
description: Documentation-only deprecation.
4825+
-->
4826+
4827+
Type: Documentation-only
4828+
4829+
`node:sqlite`'s `StatementSync` class was renamed to `Statement`.
4830+
`StatementSync` is kept as a deprecated alias. Use `Statement` instead.
4831+
48044832
[DEP0142]: #dep0142-repl_builtinlibs
48054833
[DEP0156]: #dep0156-aborted-property-and-abort-aborted-event-in-http
48064834
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf

‎doc/api/diagnostics_channel.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,14 +2003,14 @@ added: v26.8.0
20032003
* `sql` {string} The expanded SQL with bound parameter values substituted.
20042004
If expansion fails, the source SQL with unsubstituted placeholders is used
20052005
instead.
2006-
* `database` {DatabaseSync} The [`DatabaseSync`][] instance that executed the
2006+
* `database` {Database} The [`Database`][] instance that executed the
20072007
statement.
20082008
* `duration` {number} SQLite's internal estimate of the statement run time in
20092009
nanoseconds. This reflects C-layer execution time only and does not include
20102010
JavaScript binding overhead such as argument marshaling or result-row
20112011
construction.
20122012

2013-
Emitted after a SQL statement finishes executing against a [`DatabaseSync`][]
2013+
Emitted after a SQL statement finishes executing against a [`Database`][]
20142014
instance. This is a **profiling** event: it fires once per statement upon
20152015
completion and reports an estimated duration from SQLite's internal profiler.
20162016
It is not a distributed-tracing span. There is no corresponding start event,
@@ -2032,7 +2032,7 @@ statement, since both are still in use while the event is being delivered; see
20322032
[`--enable-fips-indicator-events`]: cli.md#--enable-fips-indicator-events
20332033
[`--force-fips=strict`]: cli.md#--force-fips
20342034
[`BoundedChannel`]: #class-boundedchannel
2035-
[`DatabaseSync`]: sqlite.md#class-databasesync
2035+
[`Database`]: sqlite.md#class-database
20362036
[`TracingChannel`]: #class-tracingchannel
20372037
[`asyncEnd` event]: #asyncendevent
20382038
[`asyncStart` event]: #asyncstartevent

0 commit comments

Comments
 (0)