@@ -32,7 +32,9 @@ import sqlite from 'node:sqlite';
3232const sqlite = require (' node:sqlite' );
3333```
3434
35- This module is only available under the ` node: ` scheme.
35+ This module is only available under the ` node: ` scheme. SQL trace events can
36+ be observed via the [ ` diagnostics_channel ` ] [ ] module. See
37+ [ ` 'sqlite.db.query' ` ] [ ] for details.
3638
3739The following example shows the basic usage of the ` node:sqlite ` module to open
3840an in-memory database, write data to the database, and then read the data back.
@@ -311,8 +313,8 @@ added: v22.5.0
311313Closes the database connection. An exception is thrown if the database is not
312314open. An [ ` ERR_INVALID_STATE ` ] [ ] error is thrown if the method is called while
313315a statement is executing, such as inside a user-defined function, an aggregate
314- function, or an authorizer callback. This method is a wrapper around
315- [ ` sqlite3_close_v2() ` ] [ ] .
316+ function, an authorizer callback, or a [ ` 'sqlite.db.query' ` ] [ ] subscriber. This
317+ method is a wrapper around [ ` sqlite3_close_v2() ` ] [ ] .
316318
317319### ` database.loadExtension(path[, entryPoint]) `
318320
@@ -1122,7 +1124,12 @@ added: REPLACEME
11221124-->
11231125
11241126Finalizes the prepared statement. An exception is thrown if the statement is
1125- already finalized. This method is a wrapper around [ ` sqlite3_finalize() ` ] [ ] .
1127+ already finalized. An [ ` ERR_INVALID_STATE ` ] [ ] error is thrown if this statement
1128+ is currently executing, which happens when the method is called from a callback
1129+ that the statement itself triggered, such as a user-defined function, an
1130+ aggregate function, or a [ ` 'sqlite.db.query' ` ] [ ] subscriber. Other statements
1131+ on the same connection can be finalized from such a callback. This method is a
1132+ wrapper around [ ` sqlite3_finalize() ` ] [ ] .
11261133
11271134### ` statement.columns() `
11281135
@@ -1369,7 +1376,9 @@ added: REPLACEME
13691376-->
13701377
13711378Finalizes the prepared statement. If the prepared statement is already
1372- finalized, then this is a no-op.
1379+ finalized, then this is a no-op. An [ ` ERR_INVALID_STATE ` ] [ ] error is thrown if
1380+ this statement is currently executing, under the same conditions as
1381+ [ ` statement.close() ` ] [ ] .
13731382
13741383### ` statement.stat(counter) `
13751384
@@ -1890,6 +1899,7 @@ callback function to indicate what type of operation is being authorized.
18901899[ Run-Time Limits ] : https://www.sqlite.org/c3ref/limit.html
18911900[ SQL injection ] : https://en.wikipedia.org/wiki/SQL_injection
18921901[ Type conversion between JavaScript and SQLite ] : #type-conversion-between-javascript-and-sqlite
1902+ [ `'sqlite.db.query'` ] : diagnostics_channel.md#event-sqlitedbquery
18931903[ `ATTACH DATABASE` ] : https://www.sqlite.org/lang_attach.html
18941904[ `ERR_INVALID_STATE` ] : errors.md#err_invalid_state
18951905[ `PRAGMA foreign_keys` ] : https://www.sqlite.org/pragma.html#pragma_foreign_keys
@@ -1903,6 +1913,7 @@ callback function to indicate what type of operation is being authorized.
19031913[ `database.createTagStore()` ] : #databasecreatetagstoremaxsize
19041914[ `database.serialize()` ] : #databaseserializedbname
19051915[ `database.setAuthorizer()` ] : #databasesetauthorizercallback
1916+ [ `diagnostics_channel` ] : diagnostics_channel.md
19061917[ `sqlite3_backup_finish()` ] : https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupfinish
19071918[ `sqlite3_backup_init()` ] : https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupinit
19081919[ `sqlite3_backup_step()` ] : https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep
@@ -1934,6 +1945,7 @@ callback function to indicate what type of operation is being authorized.
19341945[ `sqlite3session_create()` ] : https://www.sqlite.org/session/sqlite3session_create.html
19351946[ `sqlite3session_delete()` ] : https://www.sqlite.org/session/sqlite3session_delete.html
19361947[ `sqlite3session_patchset()` ] : https://www.sqlite.org/session/sqlite3session_patchset.html
1948+ [ `statement.close()` ] : #statementclose
19371949[ `statement.setAllowBareNamedParameters()` ] : #statementsetallowbarenamedparametersenabled
19381950[ `statement.setAllowUnknownNamedParameters()` ] : #statementsetallowunknownnamedparametersenabled
19391951[ `statement.stat()` ] : #statementstatcounter
0 commit comments