Skip to content

Commit 41d6707

Browse files
araujoguiaduh95
authored andcommitted
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 60d0aa0 commit 41d6707

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
@@ -4710,6 +4710,34 @@ async function example() {
47104710
}
47114711
```
47124712
4713+
### DEP0210: `sqlite.DatabaseSync`
4714+
4715+
<!-- YAML
4716+
changes:
4717+
- version: REPLACEME
4718+
pr-url: https://github.com/nodejs/node/pull/65988
4719+
description: Documentation-only deprecation.
4720+
-->
4721+
4722+
Type: Documentation-only
4723+
4724+
`node:sqlite`'s `DatabaseSync` class was renamed to `Database`. `DatabaseSync`
4725+
is kept as a deprecated alias. Use `Database` instead.
4726+
4727+
### DEP0211: `sqlite.StatementSync`
4728+
4729+
<!-- YAML
4730+
changes:
4731+
- version: REPLACEME
4732+
pr-url: https://github.com/nodejs/node/pull/65988
4733+
description: Documentation-only deprecation.
4734+
-->
4735+
4736+
Type: Documentation-only
4737+
4738+
`node:sqlite`'s `StatementSync` class was renamed to `Statement`.
4739+
`StatementSync` is kept as a deprecated alias. Use `Statement` instead.
4740+
47134741
[DEP0142]: #dep0142-repl_builtinlibs
47144742
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
47154743
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3

‎doc/api/diagnostics_channel.md‎

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

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

0 commit comments

Comments
 (0)