Skip to content

Commit d5cfdcf

Browse files
committed
docs(changelog): note reopen and string fixes
1 parent 9374063 commit d5cfdcf

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
44

55
## [3.0.0](https://github.com/PhotoStructure/node-sqlite/releases/tag/v3.0.0) (2026-10-02)
66

7-
API compatible with `node:sqlite` from Node.js v26.10.0, plus the `Database` and `Statement` class rename from [Node.js PR #65988](https://github.com/nodejs/node/pull/65988), which landed on `v26.x-staging` but is not yet in a Node.js release. `Database.prototype.createModule()`, also only on `v26.x-staging` so far, is not ported yet. The rename changes the classes' `name` values, so this is a major release. SQLite is unchanged at 3.53.4.
7+
API compatible with `node:sqlite` from Node.js v26.10.0, plus the `Database` and `Statement` class rename from [Node.js PR #65988](https://github.com/nodejs/node/pull/65988), which landed on `v26.x-staging`, and two fixes from Node.js `main` ([Node.js PR #66042](https://github.com/nodejs/node/pull/66042), [Node.js PR #66209](https://github.com/nodejs/node/pull/66209)). None of these is in a Node.js release yet. `Database.prototype.createModule()`, also only on `v26.x-staging` so far, is not ported yet. The rename changes the classes' `name` values, so this is a major release. SQLite is unchanged at 3.53.4.
88

99
### Added
1010

@@ -13,6 +13,8 @@ API compatible with `node:sqlite` from Node.js v26.10.0, plus the `Database` and
1313
### Changed
1414

1515
- **BREAKING**: **Class names follow the rename**: `DatabaseSync.name` and a database's `constructor.name` are now `"Database"`, `StatementSync.name` and a statement's `constructor.name` are `"Statement"`, and the iterator from `iterate()` is a `StatementIterator` (was `StatementSyncIterator`), as in `node:sqlite` from [Node.js PR #65988](https://github.com/nodejs/node/pull/65988). In 2.6.0 the exported constructors were named `"DatabaseSync2"` and `"StatementSync2"`, because the bundler renamed them, while instances reported `"DatabaseSync"` and `"StatementSync"`. Code that compares these names against the old strings must change; `instanceof DatabaseSync` and `instanceof StatementSync` still work.
16+
- **`open()` after `close()` restores the connection's settings**: a `setAuthorizer()` callback was not reinstalled, so after `close()` and `open()` a deny-all authorizer stopped denying anything; limits set through `db.limits` went back to the constructor's values; and extension loading turned on with `enableLoadExtension(true)` was off again. All three now carry over, as in `node:sqlite` from [Node.js PR #66042](https://github.com/nodejs/node/pull/66042).
17+
- **TEXT longer than V8's maximum string length throws `ERR_STRING_TOO_LONG`**: reading such a value with `get()`, `all()`, or `iterate()`, passing one to a user-defined or aggregate function, or reading one through `DatabasePool` threw `Error: Unknown failure` with no `code`. In a user-defined or aggregate function the error was a C++ exception that unwound through SQLite, after which `close()` always failed with `ERR_INVALID_STATE` (`database cannot be closed while in a callback`). It now throws `ERR_STRING_TOO_LONG`, as in `node:sqlite` from [Node.js PR #66209](https://github.com/nodejs/node/pull/66209), and the connection stays usable.
1618
- **Experimental `DatabasePool` keeps its name**: the bundler renamed the class, so `DatabasePool.name` was `"_DatabasePool"` and `util.inspect()` printed a pool as `_DatabasePool {}`. The build now keeps the source names of all exported classes and functions.
1719
- **`backup()` runs one step per threadpool job**: each `sqlite3_backup_step()` now returns to the main thread before the next one is queued, as in `node:sqlite`. The `progress` callback is therefore called after every step that leaves pages remaining; previously calls could be coalesced. Small `rate` values cost more: on tmpfs, a 128 MB backup took 580–690 ms at `rate: 1` (was 195–210 ms; `node:sqlite` 580–670 ms) and 132–150 ms at the default `rate: 100` (was 124–132 ms).
1820
- **Strings with NUL bytes are no longer truncated**: binding `"a\0b"` stored `"a"`, and user-defined and aggregate functions received only the text before the first NUL byte of a TEXT argument. Both now use the full string, as `node:sqlite` and `DatabasePool` already did. Queries that bound such strings now store and match different values.
@@ -22,6 +24,7 @@ API compatible with `node:sqlite` from Node.js v26.10.0, plus the `Database` and
2224

2325
### Fixed
2426

27+
- **SQLite errors swallowed after a throwing function in `exec()`**: when a user-defined function threw inside `exec()`, the next SQLite error on that connection was ignored, so for example an `INSERT` that violated a primary key returned `undefined` instead of throwing. Only an error with a JavaScript exception actually pending is now ignored, as in `node:sqlite` from [Node.js PR #66209](https://github.com/nodejs/node/pull/66209).
2528
- **Statements starved during `backup()`**: every backup step holds the source connection's mutex, and the whole backup ran as one threadpool loop, so a synchronous statement on the same `Database` waited for most of the backup (204 ms of a 208 ms backup of a 128 MB WAL database). It now waits for at most one step (under 1 ms at `rate: 100`).
2629
- **Worker terminated during `backup()`**: terminating a worker thread while it ran a backup with a `progress` callback aborted the process (`terminate called after throwing an instance of 'Napi::Error'`). The backup now stops at the next step without settling its promise, and the worker exits.
2730
- **`process.exit()` in a worker's backup progress callback**: aborted the process with `FATAL ERROR: Error::Error napi_define_properties`, because node-addon-api's conversion of the termination exception into a `Napi::Error` is fatal when JavaScript can no longer run. The worker now exits with the requested code. Rejection messages for a throwing `progress` callback are unchanged.

0 commit comments

Comments
 (0)