From adbc757d70e3dc2155ca6bc10b3c3118e8d7a213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Sat, 19 Sep 2026 11:41:22 +0200 Subject: [PATCH] sqlite: add StatementSync.prototype[Symbol.dispose]() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This extends explicit resource management support to prepared statements, allowing a StatementSync to be deterministically finalized via a `using` declaration, mirroring the existing DatabaseSync and Session dispose methods. Signed-off-by: Guilherme Araújo PR-URL: https://github.com/nodejs/node/pull/64232 Backport-PR-URL: https://github.com/nodejs/node/pull/66128 Reviewed-By: Antoine du Hamel --- doc/api/sqlite.md | 9 +++++ src/node_sqlite.cc | 16 ++++++-- src/node_sqlite.h | 2 + test/parallel/test-sqlite-statement-sync.js | 43 +++++++++++++++++++++ 4 files changed, 66 insertions(+), 4 deletions(-) diff --git a/doc/api/sqlite.md b/doc/api/sqlite.md index 691b7e40fd3..48355ff55a2 100644 --- a/doc/api/sqlite.md +++ b/doc/api/sqlite.md @@ -1279,6 +1279,15 @@ added: v22.5.0 The source SQL text of the prepared statement. This property is a wrapper around [`sqlite3_sql()`][]. +### `statement[Symbol.dispose]()` + + + +Finalizes the prepared statement. If the prepared statement is already +finalized, then this is a no-op. + ## Class: `SQLTagStore`