@@ -30,7 +30,9 @@ import sqlite from 'node:sqlite';
3030const sqlite = require (' node:sqlite' );
3131```
3232
33- This module is only available under the ` node: ` scheme.
33+ This module is only available under the ` node: ` scheme. SQL trace events can
34+ be observed via the [ ` diagnostics_channel ` ] [ ] module. See
35+ [ ` 'sqlite.db.query' ` ] [ ] for details.
3436
3537The following example shows the basic usage of the ` node:sqlite ` module to open
3638an in-memory database, write data to the database, and then read the data back.
@@ -300,8 +302,8 @@ added: v22.5.0
300302Closes the database connection. An exception is thrown if the database is not
301303open. An [ ` ERR_INVALID_STATE ` ] [ ] error is thrown if the method is called while
302304a statement is executing, such as inside a user-defined function, an aggregate
303- function, or an authorizer callback. This method is a wrapper around
304- [ ` sqlite3_close_v2() ` ] [ ] .
305+ function, an authorizer callback, or a [ ` 'sqlite.db.query' ` ] [ ] subscriber. This
306+ method is a wrapper around [ ` sqlite3_close_v2() ` ] [ ] .
305307
306308### ` database.loadExtension(path[, entryPoint]) `
307309
@@ -1094,7 +1096,12 @@ added: REPLACEME
10941096-->
10951097
10961098Finalizes the prepared statement. An exception is thrown if the statement is
1097- already finalized. This method is a wrapper around [ ` sqlite3_finalize() ` ] [ ] .
1099+ already finalized. An [ ` ERR_INVALID_STATE ` ] [ ] error is thrown if this statement
1100+ is currently executing, which happens when the method is called from a callback
1101+ that the statement itself triggered, such as a user-defined function, an
1102+ aggregate function, or a [ ` 'sqlite.db.query' ` ] [ ] subscriber. Other statements
1103+ on the same connection can be finalized from such a callback. This method is a
1104+ wrapper around [ ` sqlite3_finalize() ` ] [ ] .
10981105
10991106### ` statement.columns() `
11001107
@@ -1325,7 +1332,9 @@ added: REPLACEME
13251332-->
13261333
13271334Finalizes the prepared statement. If the prepared statement is already
1328- finalized, then this is a no-op.
1335+ finalized, then this is a no-op. An [ ` ERR_INVALID_STATE ` ] [ ] error is thrown if
1336+ this statement is currently executing, under the same conditions as
1337+ [ ` statement.close() ` ] [ ] .
13291338
13301339## Class: ` SQLTagStore `
13311340
@@ -1805,6 +1814,7 @@ callback function to indicate what type of operation is being authorized.
18051814[ Run-Time Limits ] : https://www.sqlite.org/c3ref/limit.html
18061815[ SQL injection ] : https://en.wikipedia.org/wiki/SQL_injection
18071816[ Type conversion between JavaScript and SQLite ] : #type-conversion-between-javascript-and-sqlite
1817+ [ `'sqlite.db.query'` ] : diagnostics_channel.md#event-sqlitedbquery
18081818[ `ATTACH DATABASE` ] : https://www.sqlite.org/lang_attach.html
18091819[ `ERR_INVALID_STATE` ] : errors.md#err_invalid_state
18101820[ `PRAGMA foreign_keys` ] : https://www.sqlite.org/pragma.html#pragma_foreign_keys
@@ -1817,6 +1827,7 @@ callback function to indicate what type of operation is being authorized.
18171827[ `database.createTagStore()` ] : #databasecreatetagstoremaxsize
18181828[ `database.serialize()` ] : #databaseserializedbname
18191829[ `database.setAuthorizer()` ] : #databasesetauthorizercallback
1830+ [ `diagnostics_channel` ] : diagnostics_channel.md
18201831[ `sqlite3_backup_finish()` ] : https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupfinish
18211832[ `sqlite3_backup_init()` ] : https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupinit
18221833[ `sqlite3_backup_step()` ] : https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep
@@ -1847,6 +1858,7 @@ callback function to indicate what type of operation is being authorized.
18471858[ `sqlite3session_create()` ] : https://www.sqlite.org/session/sqlite3session_create.html
18481859[ `sqlite3session_delete()` ] : https://www.sqlite.org/session/sqlite3session_delete.html
18491860[ `sqlite3session_patchset()` ] : https://www.sqlite.org/session/sqlite3session_patchset.html
1861+ [ `statement.close()` ] : #statementclose
18501862[ `statement.setAllowBareNamedParameters()` ] : #statementsetallowbarenamedparametersenabled
18511863[ `statement.setAllowUnknownNamedParameters()` ] : #statementsetallowunknownnamedparametersenabled
18521864[ busy timeout ] : https://sqlite.org/c3ref/busy_timeout.html
0 commit comments