{"$schema":"https://doc-kit.nodejs.org/schemas/api-doc/1.0.0.json","id":"sqlite","path":"/sqlite","type":"module","module":"sqlite","title":"SQLite","introducedIn":"v22.5.0","sourceLink":{"path":"lib/sqlite.js","url":"https://github.com/nodejs/node/blob/HEAD/lib/sqlite.js"},"stability":{"index":"1.2","description":"Release candidate."},"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v25.7.0"],"prUrl":"https://github.com/nodejs/node/pull/61262","commit":null,"description":"SQLite is now a release candidate."},{"versions":["v23.4.0","v22.13.0"],"prUrl":"https://github.com/nodejs/node/pull/55890","commit":null,"description":"SQLite is no longer behind `--experimental-sqlite` but still experimental."}],"description":"The `node:sqlite` module facilitates working with SQLite databases.\nTo access it:\n\n```mjs\nimport sqlite from 'node:sqlite';\n```\n\n```cjs\nconst sqlite = require('node:sqlite');\n```\n\nThis module is only available under the `node:` scheme. SQL trace events can\nbe observed via the [`diagnostics_channel`](diagnostics_channel.html) module. See\n[`'sqlite.db.query'`](diagnostics_channel.html#event-sqlitedbquery) for details.\n\nThe following example shows the basic usage of the `node:sqlite` module to open\nan in-memory database, write data to the database, and then read the data back.\n\n```mjs\nimport { DatabaseSync } from 'node:sqlite';\nconst database = new DatabaseSync(':memory:');\n\n// Execute SQL statements from strings.\ndatabase.exec(`\n  CREATE TABLE data(\n    key INTEGER PRIMARY KEY,\n    value TEXT\n  ) STRICT\n`);\n// Create a prepared statement to insert data into the database.\nconst insert = database.prepare('INSERT INTO data (key, value) VALUES (?, ?)');\n// Execute the prepared statement with bound values.\ninsert.run(1, 'hello');\ninsert.run(2, 'world');\n// Finalize the prepared statement once it is no longer needed.\ninsert.close();\n// Create a prepared statement to read data from the database.\nconst query = database.prepare('SELECT * FROM data ORDER BY key');\n// Execute the prepared statement and log the result set.\nconsole.log(query.all());\n// Prints: [ { key: 1, value: 'hello' }, { key: 2, value: 'world' } ]\nquery.close();\n```\n\n```cjs\nconst { DatabaseSync } = require('node:sqlite');\nconst database = new DatabaseSync(':memory:');\n\n// Execute SQL statements from strings.\ndatabase.exec(`\n  CREATE TABLE data(\n    key INTEGER PRIMARY KEY,\n    value TEXT\n  ) STRICT\n`);\n// Create a prepared statement to insert data into the database.\nconst insert = database.prepare('INSERT INTO data (key, value) VALUES (?, ?)');\n// Execute the prepared statement with bound values.\ninsert.run(1, 'hello');\ninsert.run(2, 'world');\n// Finalize the prepared statement once it is no longer needed.\ninsert.close();\n// Create a prepared statement to read data from the database.\nconst query = database.prepare('SELECT * FROM data ORDER BY key');\n// Execute the prepared statement and log the result set.\nconsole.log(query.all());\n// Prints: [ { key: 1, value: 'hello' }, { key: 2, value: 'world' } ]\nquery.close();\n```","summary":"The `node:sqlite` module facilitates working with SQLite databases. To access it:","examples":[{"language":"mjs","displayName":null,"code":"import sqlite from 'node:sqlite';"},{"language":"cjs","displayName":null,"code":"const sqlite = require('node:sqlite');"},{"language":"mjs","displayName":null,"code":"import { DatabaseSync } from 'node:sqlite';\nconst database = new DatabaseSync(':memory:');\n\n// Execute SQL statements from strings.\ndatabase.exec(`\n  CREATE TABLE data(\n    key INTEGER PRIMARY KEY,\n    value TEXT\n  ) STRICT\n`);\n// Create a prepared statement to insert data into the database.\nconst insert = database.prepare('INSERT INTO data (key, value) VALUES (?, ?)');\n// Execute the prepared statement with bound values.\ninsert.run(1, 'hello');\ninsert.run(2, 'world');\n// Finalize the prepared statement once it is no longer needed.\ninsert.close();\n// Create a prepared statement to read data from the database.\nconst query = database.prepare('SELECT * FROM data ORDER BY key');\n// Execute the prepared statement and log the result set.\nconsole.log(query.all());\n// Prints: [ { key: 1, value: 'hello' }, { key: 2, value: 'world' } ]\nquery.close();"},{"language":"cjs","displayName":null,"code":"const { DatabaseSync } = require('node:sqlite');\nconst database = new DatabaseSync(':memory:');\n\n// Execute SQL statements from strings.\ndatabase.exec(`\n  CREATE TABLE data(\n    key INTEGER PRIMARY KEY,\n    value TEXT\n  ) STRICT\n`);\n// Create a prepared statement to insert data into the database.\nconst insert = database.prepare('INSERT INTO data (key, value) VALUES (?, ?)');\n// Execute the prepared statement with bound values.\ninsert.run(1, 'hello');\ninsert.run(2, 'world');\n// Finalize the prepared statement once it is no longer needed.\ninsert.close();\n// Create a prepared statement to read data from the database.\nconst query = database.prepare('SELECT * FROM data ORDER BY key');\n// Execute the prepared statement and log the result set.\nconsole.log(query.all());\n// Prints: [ { key: 1, value: 'hello' }, { key: 2, value: 'world' } ]\nquery.close();"}],"children":[{"kind":"section","id":"type-conversion-between-javascript-and-sqlite","name":"Type conversion between JavaScript and SQLite","title":"Type conversion between JavaScript and SQLite","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"When Node.js writes to or reads from SQLite, it is necessary to convert between\nJavaScript data types and SQLite's [data types](https://www.sqlite.org/datatype3.html). Because JavaScript supports\nmore data types than SQLite, only a subset of JavaScript types are supported.\nAttempting to write an unsupported data type to SQLite will result in an\nexception.\n\n| Storage class | JavaScript to SQLite                                            | SQLite to JavaScript                  |\n| ------------- | --------------------------------------------------------------- | ------------------------------------- |\n| `NULL`        | {null}                                                          | {null}                                |\n| `INTEGER`     | {number}, {bigint}, or {boolean}                                | {number} or {bigint} *(configurable)* |\n| `REAL`        | {number}                                                        | {number}                              |\n| `TEXT`        | {string}                                                        | {string}                              |\n| `BLOB`        | {TypedArray}, {DataView}, {ArrayBuffer}, or {SharedArrayBuffer} | {Uint8Array}                          |\n\nBooleans are written as the `INTEGER` values `1` and `0`. Like any other\n`INTEGER` value, they are read back as {number} by default, or as {bigint}\nvalues (`1n` and `0n`) when reading BigInts is enabled. Writing a {bigint} that\ndoes not fit in a signed 64-bit integer throws an `ERR_INVALID_ARG_VALUE`\nerror.\n\nAPIs that read values from SQLite have a configuration option that determines\nwhether `INTEGER` values are converted to `number` or `bigint` in JavaScript,\nsuch as the `readBigInts` option for statements and the `useBigIntArguments`\noption for user-defined functions. If Node.js reads an `INTEGER` value from\nSQLite that is outside the JavaScript [safe integer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger) range, and the option to\nread BigInts is not enabled, then an `ERR_OUT_OF_RANGE` error will be thrown.","summary":"When Node.js writes to or reads from SQLite, it is necessary to convert between JavaScript data types and SQLite's data types. Because JavaScript supports more data types than SQLite, only a subset of JavaScript types are supported. Attempting to write an unsupported data type to SQLite will result in an exception.","examples":[],"children":[]},{"kind":"class","id":"class-databasesync","name":"DatabaseSync","title":"Class: `DatabaseSync`","scope":"module","overloadOf":null,"stability":null,"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v24.0.0","v22.16.0"],"prUrl":"https://github.com/nodejs/node/pull/57752","commit":null,"description":"Add `timeout` option."},{"versions":["v23.10.0","v22.15.0"],"prUrl":"https://github.com/nodejs/node/pull/56991","commit":null,"description":"The `path` argument now supports Buffer and URL objects."}],"extends":null,"description":"This class represents a single [connection](https://www.sqlite.org/c3ref/sqlite3.html) to a SQLite database. All APIs\nexposed by this class execute synchronously.","summary":"This class represents a single connection to a SQLite database. All APIs exposed by this class execute synchronously.","examples":[],"children":[{"kind":"constructor","id":"new-databasesyncpath-options","name":"DatabaseSync","title":"`new DatabaseSync(path[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v25.5.0","v24.14.0"],"prUrl":"https://github.com/nodejs/node/pull/61266","commit":null,"description":"Enable `defensive` by default."},{"versions":["v25.1.0","v24.12.0"],"prUrl":"https://github.com/nodejs/node/pull/60217","commit":null,"description":"Add `defensive` option."},{"versions":["v24.4.0","v22.18.0"],"prUrl":"https://github.com/nodejs/node/pull/58697","commit":null,"description":"Add new SQLite database options."}],"signature":{"parameters":[{"name":"path","type":{"text":"string | Buffer | URL","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Buffer","href":"buffer.html#class-buffer","start":9,"end":15},{"name":"URL","href":"url.html#the-whatwg-url-api","start":18,"end":21}]},"description":"The path of the database. A SQLite database can be\nstored in a file or completely [in memory](https://www.sqlite.org/inmemorydb.html). To use a file-backed database,\nthe path should be a file path. To use an in-memory database, the path\nshould be the special name `':memory:'`.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Configuration options for the database connection. The\nfollowing options are supported:","default":null,"optional":true,"rest":false,"properties":[{"name":"open","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, the database is opened by the constructor. When\nthis value is `false`, the database must be opened via the `open()` method.","default":"true","optional":true,"rest":false,"properties":[]},{"name":"readOnly","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, the database is opened in read-only mode.\nIf the database does not exist, opening it will fail.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"enableForeignKeyConstraints","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, foreign key constraints\nare enabled. This is recommended but can be disabled for compatibility with\nlegacy database schemas. The enforcement of foreign key constraints can be\nenabled and disabled after opening the database using\n[`PRAGMA foreign_keys`](https://www.sqlite.org/pragma.html#pragma_foreign_keys).","default":"true","optional":true,"rest":false,"properties":[]},{"name":"enableDoubleQuotedStringLiterals","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, SQLite will accept\n[double-quoted string literals](https://www.sqlite.org/quirks.html#dblquote). This is not recommended but can be\nenabled for compatibility with legacy database schemas.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"allowExtension","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, the `loadExtension` SQL function\nand the `loadExtension()` method are enabled.\nYou can call `enableLoadExtension(false)` later to disable this feature.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"timeout","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The [busy timeout](https://sqlite.org/c3ref/busy_timeout.html) in milliseconds. This is the maximum amount of\ntime that SQLite will wait for a database lock to be released before\nreturning an error.","default":"0","optional":true,"rest":false,"properties":[]},{"name":"readBigInts","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, integer fields are read as JavaScript `BigInt` values. If `false`,\ninteger fields are read as JavaScript numbers.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"returnArrays","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, query results are returned as arrays instead of objects.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"allowBareNamedParameters","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, allows binding named parameters without the prefix\ncharacter (e.g., `foo` instead of `:foo`).","default":"true","optional":true,"rest":false,"properties":[]},{"name":"allowUnknownNamedParameters","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, unknown named parameters are ignored when binding.\nIf `false`, an exception is thrown for unknown named parameters.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"defensive","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, enables the defensive flag. When the defensive flag is enabled,\nlanguage features that allow ordinary SQL to deliberately corrupt the database file are disabled.\nThe defensive flag can also be set using `enableDefensive()`.","default":"true","optional":true,"rest":false,"properties":[]},{"name":"limits","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Configuration for various SQLite limits. These limits\ncan be used to prevent excessive resource consumption when handling\npotentially malicious input. See [Run-Time Limits](https://www.sqlite.org/c3ref/limit.html) and [Limit Constants](https://www.sqlite.org/c3ref/c_limit_attached.html)\nin the SQLite documentation for details. Default values are determined by\nSQLite's compile-time defaults and may vary depending on how SQLite was\nbuilt. The following properties are supported:","default":null,"optional":false,"rest":false,"properties":[{"name":"length","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Maximum length of a string or BLOB.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"sqlLength","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Maximum length of an SQL statement.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"column","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Maximum number of columns.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"exprDepth","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Maximum depth of an expression tree.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"compoundSelect","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Maximum number of terms in a compound SELECT.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"vdbeOp","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Maximum number of VDBE instructions.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"functionArg","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Maximum number of function arguments.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"attach","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Maximum number of attached databases.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"likePatternLength","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Maximum length of a LIKE pattern.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"variableNumber","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Maximum number of SQL variables.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"triggerDepth","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Maximum trigger recursion depth.","default":null,"optional":false,"rest":false,"properties":[]}]}]}],"returns":null},"description":"Constructs a new `DatabaseSync` instance.","summary":"Constructs a new `DatabaseSync` instance.","examples":[],"children":[]},{"kind":"method","id":"databaseaggregatename-options","name":"aggregate","title":"`database.aggregate(name, options)`","scope":"module","overloadOf":null,"stability":null,"added":["v24.0.0","v22.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The name of the SQLite function to create.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Function configuration settings.","default":null,"optional":false,"rest":false,"properties":[{"name":"deterministic","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, the [`SQLITE_DETERMINISTIC`](https://www.sqlite.org/c3ref/c_deterministic.html) flag is\nset on the created function.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"directOnly","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, the [`SQLITE_DIRECTONLY`](https://www.sqlite.org/c3ref/c_deterministic.html) flag is set on\nthe created function.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"useBigIntArguments","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, integer arguments to `options.step` and `options.inverse`\nare converted to `BigInt`s. If `false`, integer arguments are passed as\nJavaScript numbers.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"varargs","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, `options.step` and `options.inverse` may be invoked with any number of\narguments (between zero and [`SQLITE_MAX_FUNCTION_ARG`](https://www.sqlite.org/limits.html#max_function_arg)). If `false`,\n`inverse` and `step` must be invoked with exactly `length` arguments.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"start","type":{"text":"number | string | null | Array | Object | Function","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":9,"end":15},{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":18,"end":22},{"name":"Array","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array","start":25,"end":30},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":33,"end":39},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":42,"end":50}]},"description":"The identity\nvalue for the aggregation function. This value is used when the aggregation\nfunction is initialized. When a {Function} is passed the identity will be its return value.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"step","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The function to call for each row in the aggregation. The\nfunction receives the current state and the row value. The return value of\nthis function should be the new state.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"result","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The function to call to get the result of the\naggregation. The function receives the final state and should return the\nresult of the aggregation.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"inverse","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"When this function is provided, the `aggregate` method will work as a window function.\nThe function receives the current state and the dropped row value. The return value of this function should be the\nnew state.","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Registers a new aggregate function with the SQLite database. This method is a wrapper around\n[`sqlite3_create_window_function()`](https://www.sqlite.org/c3ref/create_function.html).\n\nWhen used as a window function, the `result` function will be called multiple times.\n\n```cjs\nconst { DatabaseSync } = require('node:sqlite');\n\nconst db = new DatabaseSync(':memory:');\ndb.exec(`\n  CREATE TABLE t3(x, y);\n  INSERT INTO t3 VALUES ('a', 4),\n                        ('b', 5),\n                        ('c', 3),\n                        ('d', 8),\n                        ('e', 1);\n`);\n\ndb.aggregate('sumint', {\n  start: 0,\n  step: (acc, value) => acc + value,\n});\n\nusing query = db.prepare('SELECT sumint(y) as total FROM t3');\nquery.get(); // { total: 21 }\n```\n\n```mjs\nimport { DatabaseSync } from 'node:sqlite';\n\nconst db = new DatabaseSync(':memory:');\ndb.exec(`\n  CREATE TABLE t3(x, y);\n  INSERT INTO t3 VALUES ('a', 4),\n                        ('b', 5),\n                        ('c', 3),\n                        ('d', 8),\n                        ('e', 1);\n`);\n\ndb.aggregate('sumint', {\n  start: 0,\n  step: (acc, value) => acc + value,\n});\n\nusing query = db.prepare('SELECT sumint(y) as total FROM t3');\nquery.get(); // { total: 21 }\n```","summary":"Registers a new aggregate function with the SQLite database. This method is a wrapper around `sqlite3_create_window_function()`.","examples":[{"language":"cjs","displayName":null,"code":"const { DatabaseSync } = require('node:sqlite');\n\nconst db = new DatabaseSync(':memory:');\ndb.exec(`\n  CREATE TABLE t3(x, y);\n  INSERT INTO t3 VALUES ('a', 4),\n                        ('b', 5),\n                        ('c', 3),\n                        ('d', 8),\n                        ('e', 1);\n`);\n\ndb.aggregate('sumint', {\n  start: 0,\n  step: (acc, value) => acc + value,\n});\n\nusing query = db.prepare('SELECT sumint(y) as total FROM t3');\nquery.get(); // { total: 21 }"},{"language":"mjs","displayName":null,"code":"import { DatabaseSync } from 'node:sqlite';\n\nconst db = new DatabaseSync(':memory:');\ndb.exec(`\n  CREATE TABLE t3(x, y);\n  INSERT INTO t3 VALUES ('a', 4),\n                        ('b', 5),\n                        ('c', 3),\n                        ('d', 8),\n                        ('e', 1);\n`);\n\ndb.aggregate('sumint', {\n  start: 0,\n  step: (acc, value) => acc + value,\n});\n\nusing query = db.prepare('SELECT sumint(y) as total FROM t3');\nquery.get(); // { total: 21 }"}],"children":[]},{"kind":"method","id":"databaseclose","name":"close","title":"`database.close()`","scope":"module","overloadOf":null,"stability":null,"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Closes the database connection. An exception is thrown if the database is not\nopen. An [`ERR_INVALID_STATE`](errors.html#err_invalid_state) error is thrown if the method is called while\na statement is executing, such as inside a user-defined function, an aggregate\nfunction, an authorizer callback, or a [`'sqlite.db.query'`](diagnostics_channel.html#event-sqlitedbquery) subscriber. This\nmethod is a wrapper around [`sqlite3_close_v2()`](https://www.sqlite.org/c3ref/close.html).","summary":"Closes the database connection. An exception is thrown if the database is not open. An `ERR_INVALID_STATE` error is thrown if the method is called while a statement is executing, such as inside a user-defined function, an aggregate function, an authorizer callback, or a `'sqlite.db.query'` subscriber. This method is a wrapper around `sqlite3_close_v2()`.","examples":[],"children":[]},{"kind":"method","id":"databaseloadextensionpath-entrypoint","name":"loadExtension","title":"`database.loadExtension(path[, entryPoint])`","scope":"module","overloadOf":null,"stability":null,"added":["v23.5.0","v22.13.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"path","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The path to the shared library to load.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"entryPoint","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The name of the extension's entry-point function. When\nomitted, SQLite derives the entry point from the shared library's filename;\npass this argument explicitly when the derived name does not match.","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Loads a shared library into the database connection. This method is a wrapper\naround [`sqlite3_load_extension()`](https://www.sqlite.org/c3ref/load_extension.html). It is required to enable the\n`allowExtension` option when constructing the `DatabaseSync` instance.\n\n```mjs\nimport { DatabaseSync } from 'node:sqlite';\nconst database = new DatabaseSync(':memory:', { allowExtension: true });\n\n// Load using the entry point derived from the filename.\ndatabase.loadExtension('./decimal.dylib');\n\n// Override the entry point when the derived name does not match.\ndatabase.loadExtension('./base64.dylib', 'sqlite3_base64_init');\n```\n\n```cjs\nconst { DatabaseSync } = require('node:sqlite');\nconst database = new DatabaseSync(':memory:', { allowExtension: true });\n\n// Load using the entry point derived from the filename.\ndatabase.loadExtension('./decimal.dylib');\n\n// Override the entry point when the derived name does not match.\ndatabase.loadExtension('./base64.dylib', 'sqlite3_base64_init');\n```","summary":"Loads a shared library into the database connection. This method is a wrapper around `sqlite3_load_extension()`. It is required to enable the `allowExtension` option when constructing the `DatabaseSync` instance.","examples":[{"language":"mjs","displayName":null,"code":"import { DatabaseSync } from 'node:sqlite';\nconst database = new DatabaseSync(':memory:', { allowExtension: true });\n\n// Load using the entry point derived from the filename.\ndatabase.loadExtension('./decimal.dylib');\n\n// Override the entry point when the derived name does not match.\ndatabase.loadExtension('./base64.dylib', 'sqlite3_base64_init');"},{"language":"cjs","displayName":null,"code":"const { DatabaseSync } = require('node:sqlite');\nconst database = new DatabaseSync(':memory:', { allowExtension: true });\n\n// Load using the entry point derived from the filename.\ndatabase.loadExtension('./decimal.dylib');\n\n// Override the entry point when the derived name does not match.\ndatabase.loadExtension('./base64.dylib', 'sqlite3_base64_init');"}],"children":[]},{"kind":"method","id":"databaseenableloadextensionallow","name":"enableLoadExtension","title":"`database.enableLoadExtension(allow)`","scope":"module","overloadOf":null,"stability":null,"added":["v23.5.0","v22.13.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"allow","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Whether to allow loading extensions.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Enables or disables the `loadExtension` SQL function, and the `loadExtension()`\nmethod. When `allowExtension` is `false` when constructing, you cannot enable\nloading extensions for security reasons.","summary":"Enables or disables the `loadExtension` SQL function, and the `loadExtension()` method. When `allowExtension` is `false` when constructing, you cannot enable loading extensions for security reasons.","examples":[],"children":[]},{"kind":"method","id":"databaseenabledefensiveactive","name":"enableDefensive","title":"`database.enableDefensive(active)`","scope":"module","overloadOf":null,"stability":null,"added":["v25.1.0","v24.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"active","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Whether to set the defensive flag.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Enables or disables the defensive flag. When the defensive flag is active,\nlanguage features that allow ordinary SQL to deliberately corrupt the database file are disabled.\nSee [`SQLITE_DBCONFIG_DEFENSIVE`](https://www.sqlite.org/c3ref/c_dbconfig_defensive.html#sqlitedbconfigdefensive) in the SQLite documentation for details.","summary":"Enables or disables the defensive flag. When the defensive flag is active, language features that allow ordinary SQL to deliberately corrupt the database file are disabled. See `SQLITE_DBCONFIG_DEFENSIVE` in the SQLite documentation for details.","examples":[],"children":[]},{"kind":"method","id":"databaselocationdbname","name":"location","title":"`database.location([dbName])`","scope":"module","overloadOf":null,"stability":null,"added":["v24.0.0","v22.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"dbName","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Name of the database. This can be `'main'` (the default primary database) or any other\ndatabase that has been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html)","default":"'main'","optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"string | null","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":9,"end":13}]},"description":"The location of the database file. When using an in-memory database,\nthis method returns null."}},"description":"This method is a wrapper around [`sqlite3_db_filename()`](https://sqlite.org/c3ref/db_filename.html)","summary":"This method is a wrapper around `sqlite3_db_filename()`","examples":[],"children":[]},{"kind":"method","id":"databaseexecsql","name":"exec","title":"`database.exec(sql)`","scope":"module","overloadOf":null,"stability":null,"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"sql","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A SQL string to execute.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"This method allows one or more SQL statements to be executed without returning\nany results. This method is useful when executing SQL statements read from a\nfile. This method is a wrapper around [`sqlite3_exec()`](https://www.sqlite.org/c3ref/exec.html).","summary":"This method allows one or more SQL statements to be executed without returning any results. This method is useful when executing SQL statements read from a file. This method is a wrapper around `sqlite3_exec()`.","examples":[],"children":[]},{"kind":"method","id":"databasefunctionname-options-fn","name":"function","title":"`database.function(name[, options], fn)`","scope":"module","overloadOf":null,"stability":null,"added":["v23.5.0","v22.13.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The name of the SQLite function to create.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Optional configuration settings for the function. The\nfollowing properties are supported:","default":null,"optional":true,"rest":false,"properties":[{"name":"deterministic","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, the [`SQLITE_DETERMINISTIC`](https://www.sqlite.org/c3ref/c_deterministic.html) flag is\nset on the created function.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"directOnly","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, the [`SQLITE_DIRECTONLY`](https://www.sqlite.org/c3ref/c_deterministic.html) flag is set on\nthe created function.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"useBigIntArguments","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, integer arguments to `function`\nare converted to `BigInt`s. If `false`, integer arguments are passed as\nJavaScript numbers.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"varargs","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, `function` may be invoked with any number of\narguments (between zero and [`SQLITE_MAX_FUNCTION_ARG`](https://www.sqlite.org/limits.html#max_function_arg)). If `false`,\n`function` must be invoked with exactly `function.length` arguments.","default":"false","optional":true,"rest":false,"properties":[]}]},{"name":"fn","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The JavaScript function to call when the SQLite function is\ninvoked. The return value of this function should be a valid SQLite data type:\nsee [Type conversion between JavaScript and SQLite](#type-conversion-between-javascript-and-sqlite). The result defaults to\n`NULL` if the return value is `undefined`.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"This method is used to create SQLite user-defined functions. This method is a\nwrapper around [`sqlite3_create_function_v2()`](https://www.sqlite.org/c3ref/create_function.html).","summary":"This method is used to create SQLite user-defined functions. This method is a wrapper around `sqlite3_create_function_v2()`.","examples":[],"children":[]},{"kind":"method","id":"databasesetauthorizercallback","name":"setAuthorizer","title":"`database.setAuthorizer(callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v24.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/65156","commit":null,"description":"Accessing the invoking database connection from the authorizer callback now throws."}],"signature":{"parameters":[{"name":"callback","type":{"text":"Function | null","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8},{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":11,"end":15}]},"description":"The authorizer function to set, or `null` to\nclear the current authorizer.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Sets an authorizer callback that SQLite will invoke whenever it attempts to\naccess data or modify the database schema through prepared statements.\nThis can be used to implement security policies, audit access, or restrict certain operations.\nThis method is a wrapper around [`sqlite3_set_authorizer()`](https://sqlite.org/c3ref/set_authorizer.html).\n\nWhen invoked, the callback receives five arguments:\n\n* `actionCode` {number} The type of operation being performed (e.g.,\n  `SQLITE_INSERT`, `SQLITE_UPDATE`, `SQLITE_SELECT`).\n* `arg1` {string | null} The first argument (context-dependent, often a table name).\n* `arg2` {string | null} The second argument (context-dependent, often a column name).\n* `dbName` {string | null} The name of the database.\n* `triggerOrView` {string | null} The name of the trigger or view causing the access.\n\nThe callback must return one of the following constants:\n\n* `SQLITE_OK` - Allow the operation.\n* `SQLITE_DENY` - Deny the operation (causes an error).\n* `SQLITE_IGNORE` - Ignore the operation (silently skip).\n\nSQLite requires that the authorizer callback not modify the database connection\nthat invoked it, which includes preparing and stepping statements. Methods that\nwould do so throw an error with code `ERR_INVALID_STATE` while the callback is\non the stack, including `database.prepare()`, `database.exec()`, the execution\nmethods of that connection's statements, iterators, and tag stores, and\n`database.setAuthorizer()` itself. Other connections remain usable.\n\nThe callback can also be invoked from within `statement.run()`,\n`statement.get()`, and similar methods, because SQLite may re-prepare a\nstatement during execution after a schema change.\n\nSeparately, a statement that is currently being executed cannot be reentered.\nCalling `statement.close()` on it would free the virtual machine that is\nrunning, and re-running it through `statement.run()`, `statement.get()`,\n`statement.all()`, `statement.iterate()`, `iterator.next()`,\n`iterator.return()`, or the equivalent tag store methods would reset that\nvirtual machine mid-execution. All of these throw an `ERR_INVALID_STATE` error\ninstead. This applies to any callback SQLite invokes during execution, such as a\nuser-defined function. Other statements on the connection remain usable.\n\nOperations that touch no SQLite state stay available from the callback:\n`sqlTagStore.clear()`, which only drops cached statements, and `next()` and\n`return()` on an already-drained iterator, which keep returning\n`{ done: true }`.\n\n```cjs\nconst { DatabaseSync, constants } = require('node:sqlite');\nconst db = new DatabaseSync(':memory:');\n\n// Set up an authorizer that denies all table creation\ndb.setAuthorizer((actionCode) => {\n  if (actionCode === constants.SQLITE_CREATE_TABLE) {\n    return constants.SQLITE_DENY;\n  }\n  return constants.SQLITE_OK;\n});\n\n// This will work\nusing query = db.prepare('SELECT 1');\nquery.get();\n\n// This will throw an error due to authorization denial\ntry {\n  db.exec('CREATE TABLE blocked (id INTEGER)');\n} catch (err) {\n  console.log('Operation blocked:', err.message);\n}\n```\n\n```mjs\nimport { DatabaseSync, constants } from 'node:sqlite';\nconst db = new DatabaseSync(':memory:');\n\n// Set up an authorizer that denies all table creation\ndb.setAuthorizer((actionCode) => {\n  if (actionCode === constants.SQLITE_CREATE_TABLE) {\n    return constants.SQLITE_DENY;\n  }\n  return constants.SQLITE_OK;\n});\n\n// This will work\nusing query = db.prepare('SELECT 1');\nquery.get();\n\n// This will throw an error due to authorization denial\ntry {\n  db.exec('CREATE TABLE blocked (id INTEGER)');\n} catch (err) {\n  console.log('Operation blocked:', err.message);\n}\n```","summary":"Sets an authorizer callback that SQLite will invoke whenever it attempts to access data or modify the database schema through prepared statements. This can be used to implement security policies, audit access, or restrict certain operations. This method is a wrapper around `sqlite3_set_authorizer()`.","examples":[{"language":"cjs","displayName":null,"code":"const { DatabaseSync, constants } = require('node:sqlite');\nconst db = new DatabaseSync(':memory:');\n\n// Set up an authorizer that denies all table creation\ndb.setAuthorizer((actionCode) => {\n  if (actionCode === constants.SQLITE_CREATE_TABLE) {\n    return constants.SQLITE_DENY;\n  }\n  return constants.SQLITE_OK;\n});\n\n// This will work\nusing query = db.prepare('SELECT 1');\nquery.get();\n\n// This will throw an error due to authorization denial\ntry {\n  db.exec('CREATE TABLE blocked (id INTEGER)');\n} catch (err) {\n  console.log('Operation blocked:', err.message);\n}"},{"language":"mjs","displayName":null,"code":"import { DatabaseSync, constants } from 'node:sqlite';\nconst db = new DatabaseSync(':memory:');\n\n// Set up an authorizer that denies all table creation\ndb.setAuthorizer((actionCode) => {\n  if (actionCode === constants.SQLITE_CREATE_TABLE) {\n    return constants.SQLITE_DENY;\n  }\n  return constants.SQLITE_OK;\n});\n\n// This will work\nusing query = db.prepare('SELECT 1');\nquery.get();\n\n// This will throw an error due to authorization denial\ntry {\n  db.exec('CREATE TABLE blocked (id INTEGER)');\n} catch (err) {\n  console.log('Operation blocked:', err.message);\n}"}],"children":[]},{"kind":"property","id":"databaseisopen","name":"isOpen","title":"`database.isOpen`","scope":"module","overloadOf":null,"stability":null,"added":["v23.11.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"Whether the database is currently open or not.","summary":"","examples":[],"children":[]},{"kind":"property","id":"databaseistransaction","name":"isTransaction","title":"`database.isTransaction`","scope":"module","overloadOf":null,"stability":null,"added":["v24.0.0","v22.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"Whether the database is currently within a transaction. This method\nis a wrapper around [`sqlite3_get_autocommit()`](https://sqlite.org/c3ref/get_autocommit.html).","summary":"","examples":[],"children":[]},{"kind":"property","id":"databaselimits","name":"limits","title":"`database.limits`","scope":"module","overloadOf":null,"stability":null,"added":["v25.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"An object for getting and setting SQLite database limits at runtime.\nEach property corresponds to an SQLite limit and can be read or written.\n\n```js\nconst db = new DatabaseSync(':memory:');\n\n// Read current limit\nconsole.log(db.limits.length);\n\n// Set a new limit\ndb.limits.sqlLength = 100000;\n\n// Reset a limit to its compile-time maximum\ndb.limits.sqlLength = Infinity;\n```\n\nAvailable properties: `length`, `sqlLength`, `column`, `exprDepth`,\n`compoundSelect`, `vdbeOp`, `functionArg`, `attach`, `likePatternLength`,\n`variableNumber`, `triggerDepth`.\n\nSetting a property to `Infinity` resets the limit to its compile-time maximum value.","summary":"An object for getting and setting SQLite database limits at runtime. Each property corresponds to an SQLite limit and can be read or written.","examples":[{"language":"js","displayName":null,"code":"const db = new DatabaseSync(':memory:');\n\n// Read current limit\nconsole.log(db.limits.length);\n\n// Set a new limit\ndb.limits.sqlLength = 100000;\n\n// Reset a limit to its compile-time maximum\ndb.limits.sqlLength = Infinity;"}],"children":[]},{"kind":"method","id":"databaseopen","name":"open","title":"`database.open()`","scope":"module","overloadOf":null,"stability":null,"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Opens the database specified in the `path` argument of the `DatabaseSync`\nconstructor. This method should only be used when the database is not opened via\nthe constructor. An exception is thrown if the database is already open.","summary":"Opens the database specified in the `path` argument of the `DatabaseSync` constructor. This method should only be used when the database is not opened via the constructor. An exception is thrown if the database is already open.","examples":[],"children":[]},{"kind":"method","id":"databaseserializedbname","name":"serialize","title":"`database.serialize([dbName])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"dbName","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Name of the database to serialize. This can be `'main'`\n(the default primary database) or any other database that has been added with\n[`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html).","default":"'main'","optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Uint8Array","links":[{"name":"Uint8Array","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array","start":0,"end":10}]},"description":"A binary representation of the database."}},"description":"Serializes the database into a binary representation, returned as a\n`Uint8Array`. This is useful for saving, cloning, or transferring an in-memory\ndatabase. This method is a wrapper around [`sqlite3_serialize()`](https://sqlite.org/c3ref/serialize.html).\n\n```mjs\nimport { DatabaseSync } from 'node:sqlite';\n\nconst db = new DatabaseSync(':memory:');\ndb.exec('CREATE TABLE t(key INTEGER PRIMARY KEY, value TEXT)');\ndb.exec(\"INSERT INTO t VALUES (1, 'hello')\");\nconst buffer = db.serialize();\nconsole.log(buffer.length); // Prints the byte length of the database\n```\n\n```cjs\nconst { DatabaseSync } = require('node:sqlite');\n\nconst db = new DatabaseSync(':memory:');\ndb.exec('CREATE TABLE t(key INTEGER PRIMARY KEY, value TEXT)');\ndb.exec(\"INSERT INTO t VALUES (1, 'hello')\");\nconst buffer = db.serialize();\nconsole.log(buffer.length); // Prints the byte length of the database\n```","summary":"Serializes the database into a binary representation, returned as a `Uint8Array`. This is useful for saving, cloning, or transferring an in-memory database. This method is a wrapper around `sqlite3_serialize()`.","examples":[{"language":"mjs","displayName":null,"code":"import { DatabaseSync } from 'node:sqlite';\n\nconst db = new DatabaseSync(':memory:');\ndb.exec('CREATE TABLE t(key INTEGER PRIMARY KEY, value TEXT)');\ndb.exec(\"INSERT INTO t VALUES (1, 'hello')\");\nconst buffer = db.serialize();\nconsole.log(buffer.length); // Prints the byte length of the database"},{"language":"cjs","displayName":null,"code":"const { DatabaseSync } = require('node:sqlite');\n\nconst db = new DatabaseSync(':memory:');\ndb.exec('CREATE TABLE t(key INTEGER PRIMARY KEY, value TEXT)');\ndb.exec(\"INSERT INTO t VALUES (1, 'hello')\");\nconst buffer = db.serialize();\nconsole.log(buffer.length); // Prints the byte length of the database"}],"children":[]},{"kind":"method","id":"databasedeserializebuffer-options","name":"deserialize","title":"`database.deserialize(buffer[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"buffer","type":{"text":"Uint8Array","links":[{"name":"Uint8Array","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array","start":0,"end":10}]},"description":"A binary representation of a database, such as the\noutput of [`database.serialize()`](#databaseserializedbname).","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Optional configuration for the deserialization.","default":null,"optional":true,"rest":false,"properties":[{"name":"dbName","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Name of the database to deserialize into.","default":"'main'","optional":true,"rest":false,"properties":[]}]}],"returns":null},"description":"Loads a serialized database into this connection, replacing the current\ndatabase. The deserialized database is writable. Existing prepared statements\nare finalized before deserialization is attempted, even if the operation\nsubsequently fails. An [`ERR_INVALID_STATE`](errors.html#err_invalid_state) error is thrown if the method is\ncalled while a database callback is on the stack, for example a user-defined\nfunction, an aggregate function, an authorizer, or a changeset filter or conflict\nhandler. This method is a wrapper around [`sqlite3_deserialize()`](https://sqlite.org/c3ref/deserialize.html).\n\n```mjs\nimport { DatabaseSync } from 'node:sqlite';\n\nconst original = new DatabaseSync(':memory:');\noriginal.exec('CREATE TABLE t(key INTEGER PRIMARY KEY, value TEXT)');\noriginal.exec(\"INSERT INTO t VALUES (1, 'hello')\");\nconst buffer = original.serialize();\noriginal.close();\n\nconst clone = new DatabaseSync(':memory:');\nclone.deserialize(buffer);\nusing query = clone.prepare('SELECT value FROM t');\nconsole.log(query.get());\n// Prints: { value: 'hello' }\n```\n\n```cjs\nconst { DatabaseSync } = require('node:sqlite');\n\nconst original = new DatabaseSync(':memory:');\noriginal.exec('CREATE TABLE t(key INTEGER PRIMARY KEY, value TEXT)');\noriginal.exec(\"INSERT INTO t VALUES (1, 'hello')\");\nconst buffer = original.serialize();\noriginal.close();\n\nconst clone = new DatabaseSync(':memory:');\nclone.deserialize(buffer);\nusing query = clone.prepare('SELECT value FROM t');\nconsole.log(query.get());\n// Prints: { value: 'hello' }\n```","summary":"Loads a serialized database into this connection, replacing the current database. The deserialized database is writable. Existing prepared statements are finalized before deserialization is attempted, even if the operation subsequently fails. An `ERR_INVALID_STATE` error is thrown if the method is called while a database callback is on the stack, for example a user-defined function, an aggregate function, an authorizer, or a changeset filter or conflict handler. This method is a wrapper around `sqlite3_deserialize()`.","examples":[{"language":"mjs","displayName":null,"code":"import { DatabaseSync } from 'node:sqlite';\n\nconst original = new DatabaseSync(':memory:');\noriginal.exec('CREATE TABLE t(key INTEGER PRIMARY KEY, value TEXT)');\noriginal.exec(\"INSERT INTO t VALUES (1, 'hello')\");\nconst buffer = original.serialize();\noriginal.close();\n\nconst clone = new DatabaseSync(':memory:');\nclone.deserialize(buffer);\nusing query = clone.prepare('SELECT value FROM t');\nconsole.log(query.get());\n// Prints: { value: 'hello' }"},{"language":"cjs","displayName":null,"code":"const { DatabaseSync } = require('node:sqlite');\n\nconst original = new DatabaseSync(':memory:');\noriginal.exec('CREATE TABLE t(key INTEGER PRIMARY KEY, value TEXT)');\noriginal.exec(\"INSERT INTO t VALUES (1, 'hello')\");\nconst buffer = original.serialize();\noriginal.close();\n\nconst clone = new DatabaseSync(':memory:');\nclone.deserialize(buffer);\nusing query = clone.prepare('SELECT value FROM t');\nconsole.log(query.get());\n// Prints: { value: 'hello' }"}],"children":[]},{"kind":"method","id":"databasepreparesql-options","name":"prepare","title":"`database.prepare(sql[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62757","commit":null,"description":"Add the `persistent` option."},{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/65157","commit":null,"description":"Throw `ERR_INVALID_ARG_VALUE` if `sql` contains no statements."}],"signature":{"parameters":[{"name":"sql","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A SQL string to compile to a prepared statement.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Optional configuration for the prepared statement.","default":null,"optional":true,"rest":false,"properties":[{"name":"readBigInts","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, integer fields are read as `BigInt`s.","default":"inherited from database options or `false`","optional":true,"rest":false,"properties":[]},{"name":"returnArrays","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, results are returned as arrays.","default":"inherited from database options or `false`","optional":true,"rest":false,"properties":[]},{"name":"allowBareNamedParameters","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, allows binding named\nparameters without the prefix character.","default":"inherited from database options or `true`","optional":true,"rest":false,"properties":[]},{"name":"allowUnknownNamedParameters","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, unknown named parameters\nare ignored.","default":"inherited from database options or `false`","optional":true,"rest":false,"properties":[]},{"name":"persistent","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, hints to SQLite that this statement will\nbe retained for a long time and likely reused many times. SQLite currently\nresponds to this hint by avoiding lookaside memory. Corresponds to the\n[`SQLITE_PREPARE_PERSISTENT`](https://sqlite.org/c3ref/c_prepare_dont_log.html#sqlitepreparepersistent) flag.","default":"false","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"StatementSync","links":[{"name":"StatementSync","href":"sqlite.html#class-statementsync","start":0,"end":13}]},"description":"The prepared statement."}},"description":"Compiles a SQL statement into a [prepared statement](https://www.sqlite.org/c3ref/stmt.html). This method is a wrapper\naround [`sqlite3_prepare_v3()`](https://www.sqlite.org/c3ref/prepare.html).","summary":"Compiles a SQL statement into a prepared statement. This method is a wrapper around `sqlite3_prepare_v3()`.","examples":[],"children":[]},{"kind":"method","id":"databasecreatetagstoremaxsize","name":"createTagStore","title":"`database.createTagStore([maxSize])`","scope":"module","overloadOf":null,"stability":null,"added":["v24.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"maxSize","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"The maximum number of prepared statements to cache.","default":"1000","optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"SQLTagStore","links":[{"name":"SQLTagStore","href":"sqlite.html#class-sqltagstore","start":0,"end":11}]},"description":"A new SQL tag store for caching prepared statements."}},"description":"Creates a new [`SQLTagStore`](#class-sqltagstore), which is a Least Recently Used (LRU) cache\nfor storing prepared statements. This allows for the efficient reuse of\nprepared statements by tagging them with a unique identifier.\n\nWhen a tagged SQL literal is executed, the `SQLTagStore` checks if a prepared\nstatement for the corresponding SQL query string already exists in the cache.\nIf it does, the cached statement is used. If not, a new prepared statement is\ncreated, executed, and then stored in the cache for future use. This mechanism\nhelps to avoid the overhead of repeatedly parsing and preparing the same SQL\nstatements.\n\nTagged statements bind the placeholder values from the template literal as\nparameters to the underlying prepared statement. For example:\n\n```js\nsqlTagStore.get`SELECT ${value}`;\n```\n\nis equivalent to:\n\n```js\nusing statement = db.prepare('SELECT ?');\nstatement.get(value);\n```\n\nHowever, in the first example, the tag store will cache the underlying prepared\nstatement for future use.\n\n> **Note:** The `${value}` syntax in tagged statements *binds* a parameter to\n> the prepared statement. This differs from its behavior in *untagged* template\n> literals, where it performs string interpolation.\n>\n> ```js\n> // This a safe example of binding a parameter to a tagged statement.\n> sqlTagStore.run`INSERT INTO t1 (id) VALUES (${id})`;\n>\n> // This is an *unsafe* example of an untagged template string.\n> // `id` is interpolated into the query text as a string.\n> // This can lead to SQL injection and data corruption.\n> db.run(`INSERT INTO t1 (id) VALUES (${id})`);\n> ```\n\nThe tag store will match a statement from the cache if the query strings\n(including the positions of any bound placeholders) are identical.\n\n```js\n// The following statements will match in the cache:\nsqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;\nsqlTagStore.get`SELECT * FROM t1 WHERE id = ${12345} AND active = 1`;\n\n// The following statements will not match, as the query strings\n// and bound placeholders differ:\nsqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;\nsqlTagStore.get`SELECT * FROM t1 WHERE id = 12345 AND active = 1`;\n\n// The following statements will not match, as matches are case-sensitive:\nsqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;\nsqlTagStore.get`select * from t1 where id = ${id} and active = 1`;\n```\n\nThe only way of binding parameters in tagged statements is with the `${value}`\nsyntax. Do not add parameter binding placeholders (`?` etc.) to the SQL query\nstring itself.\n\n```mjs\nimport { DatabaseSync } from 'node:sqlite';\n\nconst db = new DatabaseSync(':memory:');\nconst sql = db.createTagStore();\n\ndb.exec('CREATE TABLE users (id INT, name TEXT)');\n\n// Using the 'run' method to insert data.\n// The tagged literal is used to identify the prepared statement.\nsql.run`INSERT INTO users VALUES (1, 'Alice')`;\nsql.run`INSERT INTO users VALUES (2, 'Bob')`;\n\n// Using the 'get' method to retrieve a single row.\nconst name = 'Alice';\nconst user = sql.get`SELECT * FROM users WHERE name = ${name}`;\nconsole.log(user); // { id: 1, name: 'Alice' }\n\n// Using the 'all' method to retrieve all rows.\nconst allUsers = sql.all`SELECT * FROM users ORDER BY id`;\nconsole.log(allUsers);\n// [\n//   { id: 1, name: 'Alice' },\n//   { id: 2, name: 'Bob' }\n// ]\n```\n\n```cjs\nconst { DatabaseSync } = require('node:sqlite');\n\nconst db = new DatabaseSync(':memory:');\nconst sql = db.createTagStore();\n\ndb.exec('CREATE TABLE users (id INT, name TEXT)');\n\n// Using the 'run' method to insert data.\n// The tagged literal is used to identify the prepared statement.\nsql.run`INSERT INTO users VALUES (1, 'Alice')`;\nsql.run`INSERT INTO users VALUES (2, 'Bob')`;\n\n// Using the 'get' method to retrieve a single row.\nconst name = 'Alice';\nconst user = sql.get`SELECT * FROM users WHERE name = ${name}`;\nconsole.log(user); // { id: 1, name: 'Alice' }\n\n// Using the 'all' method to retrieve all rows.\nconst allUsers = sql.all`SELECT * FROM users ORDER BY id`;\nconsole.log(allUsers);\n// [\n//   { id: 1, name: 'Alice' },\n//   { id: 2, name: 'Bob' }\n// ]\n```","summary":"Creates a new `SQLTagStore`, which is a Least Recently Used (LRU) cache for storing prepared statements. This allows for the efficient reuse of prepared statements by tagging them with a unique identifier.","examples":[{"language":"js","displayName":null,"code":"sqlTagStore.get`SELECT ${value}`;"},{"language":"js","displayName":null,"code":"using statement = db.prepare('SELECT ?');\nstatement.get(value);"},{"language":"js","displayName":null,"code":"// This a safe example of binding a parameter to a tagged statement.\nsqlTagStore.run`INSERT INTO t1 (id) VALUES (${id})`;\n\n// This is an *unsafe* example of an untagged template string.\n// `id` is interpolated into the query text as a string.\n// This can lead to SQL injection and data corruption.\ndb.run(`INSERT INTO t1 (id) VALUES (${id})`);"},{"language":"js","displayName":null,"code":"// The following statements will match in the cache:\nsqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;\nsqlTagStore.get`SELECT * FROM t1 WHERE id = ${12345} AND active = 1`;\n\n// The following statements will not match, as the query strings\n// and bound placeholders differ:\nsqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;\nsqlTagStore.get`SELECT * FROM t1 WHERE id = 12345 AND active = 1`;\n\n// The following statements will not match, as matches are case-sensitive:\nsqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;\nsqlTagStore.get`select * from t1 where id = ${id} and active = 1`;"},{"language":"mjs","displayName":null,"code":"import { DatabaseSync } from 'node:sqlite';\n\nconst db = new DatabaseSync(':memory:');\nconst sql = db.createTagStore();\n\ndb.exec('CREATE TABLE users (id INT, name TEXT)');\n\n// Using the 'run' method to insert data.\n// The tagged literal is used to identify the prepared statement.\nsql.run`INSERT INTO users VALUES (1, 'Alice')`;\nsql.run`INSERT INTO users VALUES (2, 'Bob')`;\n\n// Using the 'get' method to retrieve a single row.\nconst name = 'Alice';\nconst user = sql.get`SELECT * FROM users WHERE name = ${name}`;\nconsole.log(user); // { id: 1, name: 'Alice' }\n\n// Using the 'all' method to retrieve all rows.\nconst allUsers = sql.all`SELECT * FROM users ORDER BY id`;\nconsole.log(allUsers);\n// [\n//   { id: 1, name: 'Alice' },\n//   { id: 2, name: 'Bob' }\n// ]"},{"language":"cjs","displayName":null,"code":"const { DatabaseSync } = require('node:sqlite');\n\nconst db = new DatabaseSync(':memory:');\nconst sql = db.createTagStore();\n\ndb.exec('CREATE TABLE users (id INT, name TEXT)');\n\n// Using the 'run' method to insert data.\n// The tagged literal is used to identify the prepared statement.\nsql.run`INSERT INTO users VALUES (1, 'Alice')`;\nsql.run`INSERT INTO users VALUES (2, 'Bob')`;\n\n// Using the 'get' method to retrieve a single row.\nconst name = 'Alice';\nconst user = sql.get`SELECT * FROM users WHERE name = ${name}`;\nconsole.log(user); // { id: 1, name: 'Alice' }\n\n// Using the 'all' method to retrieve all rows.\nconst allUsers = sql.all`SELECT * FROM users ORDER BY id`;\nconsole.log(allUsers);\n// [\n//   { id: 1, name: 'Alice' },\n//   { id: 2, name: 'Bob' }\n// ]"}],"children":[]},{"kind":"method","id":"databasecreatesessionoptions","name":"createSession","title":"`database.createSession([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v23.3.0","v22.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"The configuration options for the session.","default":null,"optional":true,"rest":false,"properties":[{"name":"table","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A specific table to track changes for. By default, changes to all tables are tracked.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"db","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Name of the database to track. This is useful when multiple databases have been added using [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html). **Default**: `'main'`.","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Session","links":[{"name":"Session","href":"sqlite.html#class-session","start":0,"end":7}]},"description":"A session handle."}},"description":"Creates and attaches a session to the database. This method is a wrapper around [`sqlite3session_create()`](https://www.sqlite.org/session/sqlite3session_create.html) and [`sqlite3session_attach()`](https://www.sqlite.org/session/sqlite3session_attach.html).","summary":"Creates and attaches a session to the database. This method is a wrapper around `sqlite3session_create()` and `sqlite3session_attach()`.","examples":[],"children":[]},{"kind":"method","id":"databaseapplychangesetchangeset-options","name":"applyChangeset","title":"`database.applyChangeset(changeset[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v23.3.0","v22.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"changeset","type":{"text":"Uint8Array","links":[{"name":"Uint8Array","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array","start":0,"end":10}]},"description":"A binary changeset or patchset.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"The configuration options for how the changes will be applied.","default":null,"optional":true,"rest":false,"properties":[{"name":"filter","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"for each table affected by at least\none change in the changeset, the `filter` callback is invoked with the\ntable name as the first argument. If the return value is falsy, then no\nattempt is made to apply any changes to the table.\nOtherwise, if the return value is truthy or no `filter` callback is provided,\nall changes related to the table are attempted.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"onConflict","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"A function that determines how to handle conflicts. The function receives one argument,\nwhich can be one of the following values:\n\nThe function should return one of the following values:\n\n* `SQLITE_CHANGESET_OMIT`: Omit conflicting changes.\n* `SQLITE_CHANGESET_REPLACE`: Replace existing values with conflicting changes (only valid with\n  `SQLITE_CHANGESET_DATA` or `SQLITE_CHANGESET_CONFLICT` conflicts).\n* `SQLITE_CHANGESET_ABORT`: Abort on conflict and roll back the database.\n\nWhen an error is thrown in the conflict handler or when any other value is returned from the handler,\napplying the changeset is aborted and the database is rolled back.\n\n**Default**: A function that returns `SQLITE_CHANGESET_ABORT`.","default":null,"optional":false,"rest":false,"properties":[{"name":"SQLITE_CHANGESET_DATA","type":null,"description":"A `DELETE` or `UPDATE` change does not contain the expected \"before\" values.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"SQLITE_CHANGESET_NOTFOUND","type":null,"description":"A row matching the primary key of the `DELETE` or `UPDATE` change does not exist.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"SQLITE_CHANGESET_CONFLICT","type":null,"description":"An `INSERT` change results in a duplicate primary key.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"SQLITE_CHANGESET_FOREIGN_KEY","type":null,"description":"Applying a change would result in a foreign key violation.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"SQLITE_CHANGESET_CONSTRAINT","type":null,"description":"Applying a change results in a `UNIQUE`, `CHECK`, or `NOT NULL` constraint\nviolation.","default":null,"optional":false,"rest":false,"properties":[]}]}]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Whether the changeset was applied successfully without being aborted."}},"description":"An exception is thrown if the database is not\nopen. This method is a wrapper around [`sqlite3changeset_apply()`](https://www.sqlite.org/session/sqlite3changeset_apply.html).\n\n```mjs\nimport { DatabaseSync } from 'node:sqlite';\n\nconst sourceDb = new DatabaseSync(':memory:');\nconst targetDb = new DatabaseSync(':memory:');\n\nsourceDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');\ntargetDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');\n\nconst session = sourceDb.createSession();\n\nusing insert = sourceDb.prepare('INSERT INTO data (key, value) VALUES (?, ?)');\ninsert.run(1, 'hello');\ninsert.run(2, 'world');\n\nconst changeset = session.changeset();\ntargetDb.applyChangeset(changeset);\n// Now that the changeset has been applied, targetDb contains the same data as sourceDb.\n```\n\n```cjs\nconst { DatabaseSync } = require('node:sqlite');\n\nconst sourceDb = new DatabaseSync(':memory:');\nconst targetDb = new DatabaseSync(':memory:');\n\nsourceDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');\ntargetDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');\n\nconst session = sourceDb.createSession();\n\nusing insert = sourceDb.prepare('INSERT INTO data (key, value) VALUES (?, ?)');\ninsert.run(1, 'hello');\ninsert.run(2, 'world');\n\nconst changeset = session.changeset();\ntargetDb.applyChangeset(changeset);\n// Now that the changeset has been applied, targetDb contains the same data as sourceDb.\n```","summary":"An exception is thrown if the database is not open. This method is a wrapper around `sqlite3changeset_apply()`.","examples":[{"language":"mjs","displayName":null,"code":"import { DatabaseSync } from 'node:sqlite';\n\nconst sourceDb = new DatabaseSync(':memory:');\nconst targetDb = new DatabaseSync(':memory:');\n\nsourceDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');\ntargetDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');\n\nconst session = sourceDb.createSession();\n\nusing insert = sourceDb.prepare('INSERT INTO data (key, value) VALUES (?, ?)');\ninsert.run(1, 'hello');\ninsert.run(2, 'world');\n\nconst changeset = session.changeset();\ntargetDb.applyChangeset(changeset);\n// Now that the changeset has been applied, targetDb contains the same data as sourceDb."},{"language":"cjs","displayName":null,"code":"const { DatabaseSync } = require('node:sqlite');\n\nconst sourceDb = new DatabaseSync(':memory:');\nconst targetDb = new DatabaseSync(':memory:');\n\nsourceDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');\ntargetDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');\n\nconst session = sourceDb.createSession();\n\nusing insert = sourceDb.prepare('INSERT INTO data (key, value) VALUES (?, ?)');\ninsert.run(1, 'hello');\ninsert.run(2, 'world');\n\nconst changeset = session.changeset();\ntargetDb.applyChangeset(changeset);\n// Now that the changeset has been applied, targetDb contains the same data as sourceDb."}],"children":[]},{"kind":"method","id":"databasesymboldispose","name":"[Symbol.dispose]","title":"`database[Symbol.dispose]()`","scope":"module","overloadOf":null,"stability":null,"added":["v23.11.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v24.2.0"],"prUrl":"https://github.com/nodejs/node/pull/58467","commit":null,"description":"No longer experimental."}],"signature":{"parameters":[],"returns":null},"description":"Closes the database connection. If the database connection is already closed\nthen this is a no-op.","summary":"Closes the database connection. If the database connection is already closed then this is a no-op.","examples":[],"children":[]}]},{"kind":"class","id":"class-session","name":"Session","title":"Class: `Session`","scope":"module","overloadOf":null,"stability":null,"added":["v23.3.0","v22.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"","summary":"","examples":[],"children":[{"kind":"method","id":"sessionchangeset","name":"changeset","title":"`session.changeset()`","scope":"module","overloadOf":null,"stability":null,"added":["v23.3.0","v22.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Uint8Array","links":[{"name":"Uint8Array","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array","start":0,"end":10}]},"description":"Binary changeset that can be applied to other databases."}},"description":"Retrieves a changeset containing all changes since the changeset was created. Can be called multiple times.\nAn exception is thrown if the database or the session is not open. This method is a wrapper around [`sqlite3session_changeset()`](https://www.sqlite.org/session/sqlite3session_changeset.html).","summary":"Retrieves a changeset containing all changes since the changeset was created. Can be called multiple times. An exception is thrown if the database or the session is not open. This method is a wrapper around `sqlite3session_changeset()`.","examples":[],"children":[]},{"kind":"method","id":"sessionpatchset","name":"patchset","title":"`session.patchset()`","scope":"module","overloadOf":null,"stability":null,"added":["v23.3.0","v22.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Uint8Array","links":[{"name":"Uint8Array","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array","start":0,"end":10}]},"description":"Binary patchset that can be applied to other databases."}},"description":"Similar to the method above, but generates a more compact patchset. See [Changesets and Patchsets](https://www.sqlite.org/sessionintro.html#changesets_and_patchsets)\nin the documentation of SQLite. An exception is thrown if the database or the session is not open. This method is a\nwrapper around [`sqlite3session_patchset()`](https://www.sqlite.org/session/sqlite3session_patchset.html).","summary":"Similar to the method above, but generates a more compact patchset. See Changesets and Patchsets in the documentation of SQLite. An exception is thrown if the database or the session is not open. This method is a wrapper around `sqlite3session_patchset()`.","examples":[],"children":[]},{"kind":"method","id":"sessionclose","name":"close","title":"`session.close()`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Closes the session. An exception is thrown if the database or the session is not open,\nor if the session is currently generating a changeset or patchset. This method is a\nwrapper around [`sqlite3session_delete()`](https://www.sqlite.org/session/sqlite3session_delete.html).","summary":"Closes the session. An exception is thrown if the database or the session is not open, or if the session is currently generating a changeset or patchset. This method is a wrapper around `sqlite3session_delete()`.","examples":[],"children":[]},{"kind":"method","id":"sessionsymboldispose","name":"[Symbol.dispose]","title":"`session[Symbol.dispose]()`","scope":"module","overloadOf":null,"stability":null,"added":["v24.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Closes the session. If the session is already closed, does nothing.","summary":"Closes the session. If the session is already closed, does nothing.","examples":[],"children":[]}]},{"kind":"class","id":"class-statementsync","name":"StatementSync","title":"Class: `StatementSync`","scope":"module","overloadOf":null,"stability":null,"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"This class represents a single [prepared statement](https://www.sqlite.org/c3ref/stmt.html). This class cannot be\ninstantiated via its constructor. Instead, instances are created via the\n`database.prepare()` method. All APIs exposed by this class execute\nsynchronously.\n\nA prepared statement is an efficient binary representation of the SQL used to\ncreate it. Prepared statements are parameterizable, and can be invoked multiple\ntimes with different bound values. Parameters also offer protection against\n[SQL injection](https://en.wikipedia.org/wiki/SQL_injection) attacks. For these reasons, prepared statements are preferred\nover hand-crafted SQL strings when handling user input.","summary":"This class represents a single prepared statement. This class cannot be instantiated via its constructor. Instead, instances are created via the `database.prepare()` method. All APIs exposed by this class execute synchronously.","examples":[],"children":[{"kind":"section","id":"binding-parameters","name":"Binding parameters","title":"Binding parameters","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The `all()`, `get()`, `iterate()`, and `run()` methods bind their arguments to\nthe parameters of the prepared statement before executing it. Parameters are\neither anonymous or named.\n\nAnonymous parameters are written as `?` in SQL and are bound in order from the\narguments passed to the method. The `?NNN` form assigns SQLite parameter index\n`NNN` to a placeholder. Avoid mixing numbered and named parameters because they\nshare parameter indexes.\n\n```js\ndb.prepare('SELECT ? AS a, ? AS b').get('x', 42);\n// { a: 'x', b: 42 }\ndb.prepare('SELECT ?2 AS a, ?1 AS b').get('first', 'second');\n// { a: 'second', b: 'first' }\n```\n\nNamed parameters begin with one of the prefix characters `$`, `:`, or `@` in\nSQL. They are bound from an object passed as the first argument. Repeating a\nname in the SQL binds the same value to every occurrence.\n\n```js\ndb.prepare('SELECT $a AS a, $b AS b').get({ $a: 1, $b: 2 });\n// { a: 1, b: 2 }\ndb.prepare('SELECT :a AS a').get({ ':a': 1 });\n// { a: 1 }\ndb.prepare('SELECT @a AS a').get({ '@a': 1 });\n// { a: 1 }\ndb.prepare('SELECT $k AS a, $k AS b').get({ k: 7 });\n// { a: 7, b: 7 }\n```\n\nThe last example omits the prefix character from the object key. Bare names are\nallowed by default; see [`statement.setAllowBareNamedParameters()`](#statementsetallowbarenamedparametersenabled) for their\ncaveats.\n\nBinding a key that does not name a parameter of the statement throws an\n`ERR_INVALID_STATE` error unless unknown named parameters are ignored. See\n[`statement.setAllowUnknownNamedParameters()`](#statementsetallowunknownnamedparametersenabled).\n\nSee [Type conversion between JavaScript and SQLite](#type-conversion-between-javascript-and-sqlite) for the values that can be\nbound. Binding any other value throws an `ERR_INVALID_ARG_TYPE` error.","summary":"The `all()`, `get()`, `iterate()`, and `run()` methods bind their arguments to the parameters of the prepared statement before executing it. Parameters are either anonymous or named.","examples":[{"language":"js","displayName":null,"code":"db.prepare('SELECT ? AS a, ? AS b').get('x', 42);\n// { a: 'x', b: 42 }\ndb.prepare('SELECT ?2 AS a, ?1 AS b').get('first', 'second');\n// { a: 'second', b: 'first' }"},{"language":"js","displayName":null,"code":"db.prepare('SELECT $a AS a, $b AS b').get({ $a: 1, $b: 2 });\n// { a: 1, b: 2 }\ndb.prepare('SELECT :a AS a').get({ ':a': 1 });\n// { a: 1 }\ndb.prepare('SELECT @a AS a').get({ '@a': 1 });\n// { a: 1 }\ndb.prepare('SELECT $k AS a, $k AS b').get({ k: 7 });\n// { a: 7, b: 7 }"}],"children":[]},{"kind":"method","id":"statementallnamedparameters-anonymousparameters","name":"all","title":"`statement.all([namedParameters][, ...anonymousParameters])`","scope":"module","overloadOf":null,"stability":null,"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62001","commit":null,"description":"Add support for boolean values in bound parameters."},{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62061","commit":null,"description":"Add support for `ArrayBuffer` and `SharedArrayBuffer` objects in bound parameters."},{"versions":["v23.7.0","v22.14.0"],"prUrl":"https://github.com/nodejs/node/pull/56385","commit":null,"description":"Add support for `DataView` and typed array objects for `anonymousParameters`."}],"signature":{"parameters":[{"name":"namedParameters","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"An optional object used to bind named parameters.\nThe keys of this object are used to configure the mapping.","default":null,"optional":true,"rest":false,"properties":[]},{"name":"anonymousParameters","type":{"text":"null | number | bigint | boolean | string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer","links":[{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":0,"end":4},{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":7,"end":13},{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":16,"end":22},{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":25,"end":32},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":35,"end":41},{"name":"Buffer","href":"buffer.html#class-buffer","start":44,"end":50},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":53,"end":63},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":66,"end":74},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":77,"end":88},{"name":"SharedArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer","start":91,"end":108}]},"description":"Zero or more values to bind to anonymous parameters.","default":null,"optional":true,"rest":true,"properties":[]}],"returns":{"type":{"text":"Array","links":[{"name":"Array","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array","start":0,"end":5}]},"description":"An array of objects. Each object corresponds to a row\nreturned by executing the prepared statement. The keys and values of each\nobject correspond to the column names and values of the row."}},"description":"This method executes a prepared statement and returns all results as an array of\nobjects. If the prepared statement does not return any results, this method\nreturns an empty array. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using\nthe values in `namedParameters` and `anonymousParameters`. See\n[Binding parameters](#binding-parameters).","summary":"This method executes a prepared statement and returns all results as an array of objects. If the prepared statement does not return any results, this method returns an empty array. The prepared statement parameters are bound using the values in `namedParameters` and `anonymousParameters`. See Binding parameters.","examples":[],"children":[]},{"kind":"method","id":"statementclose","name":"close","title":"`statement.close()`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Finalizes the prepared statement. An exception is thrown if the statement is\nalready finalized. An [`ERR_INVALID_STATE`](errors.html#err_invalid_state) error is thrown if this statement\nis currently executing, which happens when the method is called from a callback\nthat the statement itself triggered, such as a user-defined function, an\naggregate function, or a [`'sqlite.db.query'`](diagnostics_channel.html#event-sqlitedbquery) subscriber. Idle statements\non the same connection can be finalized from such a callback. This method is a\nwrapper around [`sqlite3_finalize()`](https://www.sqlite.org/c3ref/finalize.html).","summary":"Finalizes the prepared statement. An exception is thrown if the statement is already finalized. An `ERR_INVALID_STATE` error is thrown if this statement is currently executing, which happens when the method is called from a callback that the statement itself triggered, such as a user-defined function, an aggregate function, or a `'sqlite.db.query'` subscriber. Idle statements on the same connection can be finalized from such a callback. This method is a wrapper around `sqlite3_finalize()`.","examples":[],"children":[]},{"kind":"method","id":"statementcolumns","name":"columns","title":"`statement.columns()`","scope":"module","overloadOf":null,"stability":null,"added":["v23.11.0","v22.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Array","links":[{"name":"Array","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array","start":0,"end":5}]},"description":"An array of objects. Each object corresponds to a column\nin the prepared statement, and contains the following properties:"}},"description":"This method is used to retrieve information about the columns returned by the\nprepared statement.","summary":"This method is used to retrieve information about the columns returned by the prepared statement.","examples":[],"children":[]},{"kind":"property","id":"statementexpandedsql","name":"expandedSQL","title":"`statement.expandedSQL`","scope":"module","overloadOf":null,"stability":null,"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The source SQL expanded to include parameter values.\n\nThe source SQL text of the prepared statement with parameter\nplaceholders replaced by the values that were used during the most recent\nexecution of this prepared statement. This property is a wrapper around\n[`sqlite3_expanded_sql()`](https://www.sqlite.org/c3ref/expanded_sql.html).","summary":"The source SQL text of the prepared statement with parameter placeholders replaced by the values that were used during the most recent execution of this prepared statement. This property is a wrapper around `sqlite3_expanded_sql()`.","examples":[],"children":[]},{"kind":"method","id":"statementgetnamedparameters-anonymousparameters","name":"get","title":"`statement.get([namedParameters][, ...anonymousParameters])`","scope":"module","overloadOf":null,"stability":null,"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62001","commit":null,"description":"Add support for boolean values in bound parameters."},{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62061","commit":null,"description":"Add support for `ArrayBuffer` and `SharedArrayBuffer` objects in bound parameters."},{"versions":["v23.7.0","v22.14.0"],"prUrl":"https://github.com/nodejs/node/pull/56385","commit":null,"description":"Add support for `DataView` and typed array objects for `anonymousParameters`."}],"signature":{"parameters":[{"name":"namedParameters","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"An optional object used to bind named parameters.\nThe keys of this object are used to configure the mapping.","default":null,"optional":true,"rest":false,"properties":[]},{"name":"anonymousParameters","type":{"text":"null | number | bigint | boolean | string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer","links":[{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":0,"end":4},{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":7,"end":13},{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":16,"end":22},{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":25,"end":32},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":35,"end":41},{"name":"Buffer","href":"buffer.html#class-buffer","start":44,"end":50},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":53,"end":63},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":66,"end":74},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":77,"end":88},{"name":"SharedArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer","start":91,"end":108}]},"description":"Zero or more values to bind to anonymous parameters.","default":null,"optional":true,"rest":true,"properties":[]}],"returns":{"type":{"text":"Object | undefined","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6},{"name":"undefined","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#undefined_type","start":9,"end":18}]},"description":"An object corresponding to the first row returned\nby executing the prepared statement. The keys and values of the object\ncorrespond to the column names and values of the row. If no rows were returned\nfrom the database then this method returns `undefined`."}},"description":"This method executes a prepared statement and returns the first result as an\nobject. If the prepared statement does not return any results, this method\nreturns `undefined`. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the\nvalues in `namedParameters` and `anonymousParameters`. See\n[Binding parameters](#binding-parameters).","summary":"This method executes a prepared statement and returns the first result as an object. If the prepared statement does not return any results, this method returns `undefined`. The prepared statement parameters are bound using the values in `namedParameters` and `anonymousParameters`. See Binding parameters.","examples":[],"children":[]},{"kind":"method","id":"statementiteratenamedparameters-anonymousparameters","name":"iterate","title":"`statement.iterate([namedParameters][, ...anonymousParameters])`","scope":"module","overloadOf":null,"stability":null,"added":["v23.4.0","v22.13.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62001","commit":null,"description":"Add support for boolean values in bound parameters."},{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62061","commit":null,"description":"Add support for `ArrayBuffer` and `SharedArrayBuffer` objects in bound parameters."},{"versions":["v23.7.0","v22.14.0"],"prUrl":"https://github.com/nodejs/node/pull/56385","commit":null,"description":"Add support for `DataView` and typed array objects for `anonymousParameters`."}],"signature":{"parameters":[{"name":"namedParameters","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"An optional object used to bind named parameters.\nThe keys of this object are used to configure the mapping.","default":null,"optional":true,"rest":false,"properties":[]},{"name":"anonymousParameters","type":{"text":"null | number | bigint | boolean | string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer","links":[{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":0,"end":4},{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":7,"end":13},{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":16,"end":22},{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":25,"end":32},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":35,"end":41},{"name":"Buffer","href":"buffer.html#class-buffer","start":44,"end":50},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":53,"end":63},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":66,"end":74},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":77,"end":88},{"name":"SharedArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer","start":91,"end":108}]},"description":"Zero or more values to bind to anonymous parameters.","default":null,"optional":true,"rest":true,"properties":[]}],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":"An iterable iterator of objects. Each object corresponds to a row\nreturned by executing the prepared statement. The keys and values of each\nobject correspond to the column names and values of the row."}},"description":"This method executes a prepared statement and returns an iterator of\nobjects. If the prepared statement does not return any results, this method\nreturns an empty iterator. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using\nthe values in `namedParameters` and `anonymousParameters`. See\n[Binding parameters](#binding-parameters).","summary":"This method executes a prepared statement and returns an iterator of objects. If the prepared statement does not return any results, this method returns an empty iterator. The prepared statement parameters are bound using the values in `namedParameters` and `anonymousParameters`. See Binding parameters.","examples":[],"children":[]},{"kind":"method","id":"statementresetstats","name":"resetStats","title":"`statement.resetStats()`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Resets every counter reported by [`statement.stat()`](#statementstatcounter) back to zero, except\n`memused`, which reports current memory usage and cannot be reset. This\nmethod is a wrapper around [`sqlite3_stmt_status()`](https://www.sqlite.org/c3ref/stmt_status.html) and is useful for\nmeasuring a specific workload without the counts accumulated by earlier\nexecutions of the same prepared statement.","summary":"Resets every counter reported by `statement.stat()` back to zero, except `memused`, which reports current memory usage and cannot be reset. This method is a wrapper around `sqlite3_stmt_status()` and is useful for measuring a specific workload without the counts accumulated by earlier executions of the same prepared statement.","examples":[],"children":[]},{"kind":"method","id":"statementrunnamedparameters-anonymousparameters","name":"run","title":"`statement.run([namedParameters][, ...anonymousParameters])`","scope":"module","overloadOf":null,"stability":null,"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62001","commit":null,"description":"Add support for boolean values in bound parameters."},{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62061","commit":null,"description":"Add support for `ArrayBuffer` and `SharedArrayBuffer` objects in bound parameters."},{"versions":["v23.7.0","v22.14.0"],"prUrl":"https://github.com/nodejs/node/pull/56385","commit":null,"description":"Add support for `DataView` and typed array objects for `anonymousParameters`."}],"signature":{"parameters":[{"name":"namedParameters","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"An optional object used to bind named parameters.\nThe keys of this object are used to configure the mapping.","default":null,"optional":true,"rest":false,"properties":[]},{"name":"anonymousParameters","type":{"text":"null | number | bigint | boolean | string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer","links":[{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":0,"end":4},{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":7,"end":13},{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":16,"end":22},{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":25,"end":32},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":35,"end":41},{"name":"Buffer","href":"buffer.html#class-buffer","start":44,"end":50},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":53,"end":63},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":66,"end":74},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":77,"end":88},{"name":"SharedArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer","start":91,"end":108}]},"description":"Zero or more values to bind to anonymous parameters.","default":null,"optional":true,"rest":true,"properties":[]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":""}},"description":"This method executes a prepared statement and returns an object summarizing the\nresulting changes. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the\nvalues in `namedParameters` and `anonymousParameters`. See\n[Binding parameters](#binding-parameters).","summary":"This method executes a prepared statement and returns an object summarizing the resulting changes. The prepared statement parameters are bound using the values in `namedParameters` and `anonymousParameters`. See Binding parameters.","examples":[],"children":[]},{"kind":"method","id":"statementsetallowbarenamedparametersenabled","name":"setAllowBareNamedParameters","title":"`statement.setAllowBareNamedParameters(enabled)`","scope":"module","overloadOf":null,"stability":null,"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"enabled","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Enables or disables support for binding named parameters\nwithout the prefix character.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"The names of SQLite parameters begin with a prefix character. However, with the\nexception of the dollar sign character, these prefix characters also require\nextra quoting when used in object keys.\n\nTo improve ergonomics, `node:sqlite` allows bare named parameters, which do not\nrequire the prefix character in JavaScript code, by default. This method can be\nused to disable that behavior, requiring the prefix character when binding.\nThere are several caveats to be aware of when bare named parameters are\nallowed:\n\n* The prefix character is still required in SQL.\n* The prefix character is still allowed in JavaScript. In fact, prefixed names\n  will have slightly better binding performance.\n* Using ambiguous named parameters, such as `$k` and `@k`, in the same prepared\n  statement will result in an exception as it cannot be determined how to bind\n  a bare name.","summary":"The names of SQLite parameters begin with a prefix character. However, with the exception of the dollar sign character, these prefix characters also require extra quoting when used in object keys.","examples":[],"children":[]},{"kind":"method","id":"statementsetallowunknownnamedparametersenabled","name":"setAllowUnknownNamedParameters","title":"`statement.setAllowUnknownNamedParameters(enabled)`","scope":"module","overloadOf":null,"stability":null,"added":["v23.11.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"enabled","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Enables or disables support for unknown named parameters.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"By default, if an unknown name is encountered while binding parameters, an\nexception is thrown. This method allows unknown named parameters to be ignored.","summary":"By default, if an unknown name is encountered while binding parameters, an exception is thrown. This method allows unknown named parameters to be ignored.","examples":[],"children":[]},{"kind":"method","id":"statementsetreturnarraysenabled","name":"setReturnArrays","title":"`statement.setReturnArrays(enabled)`","scope":"module","overloadOf":null,"stability":null,"added":["v24.0.0","v22.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"enabled","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Enables or disables the return of query results as arrays.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"When enabled, query results returned by the `all()`, `get()`, and `iterate()` methods will be returned as arrays instead\nof objects.","summary":"When enabled, query results returned by the `all()`, `get()`, and `iterate()` methods will be returned as arrays instead of objects.","examples":[],"children":[]},{"kind":"method","id":"statementsetreadbigintsenabled","name":"setReadBigInts","title":"`statement.setReadBigInts(enabled)`","scope":"module","overloadOf":null,"stability":null,"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"enabled","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Enables or disables the use of `BigInt`s when reading\n`INTEGER` fields from the database.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"When reading from the database, SQLite `INTEGER`s are mapped to JavaScript\nnumbers by default. However, SQLite `INTEGER`s can store values larger than\nJavaScript numbers are capable of representing. In such cases, this method can\nbe used to read `INTEGER` data using JavaScript `BigInt`s. This method has no\nimpact on database write operations where numbers and `BigInt`s are both\nsupported at all times.","summary":"When reading from the database, SQLite `INTEGER`s are mapped to JavaScript numbers by default. However, SQLite `INTEGER`s can store values larger than JavaScript numbers are capable of representing. In such cases, this method can be used to read `INTEGER` data using JavaScript `BigInt`s. This method has no impact on database write operations where numbers and `BigInt`s are both supported at all times.","examples":[],"children":[]},{"kind":"property","id":"statementsourcesql","name":"sourceSQL","title":"`statement.sourceSQL`","scope":"module","overloadOf":null,"stability":null,"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The source SQL used to create this prepared statement.\n\nThe source SQL text of the prepared statement. This property is a\nwrapper around [`sqlite3_sql()`](https://www.sqlite.org/c3ref/expanded_sql.html).","summary":"The source SQL text of the prepared statement. This property is a wrapper around `sqlite3_sql()`.","examples":[],"children":[]},{"kind":"method","id":"statementsymboldispose","name":"[Symbol.dispose]","title":"`statement[Symbol.dispose]()`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Finalizes the prepared statement. If the prepared statement is already\nfinalized, then this is a no-op. An [`ERR_INVALID_STATE`](errors.html#err_invalid_state) error is thrown if\nthis statement is currently executing, under the same conditions as\n[`statement.close()`](#statementclose).","summary":"Finalizes the prepared statement. If the prepared statement is already finalized, then this is a no-op. An `ERR_INVALID_STATE` error is thrown if this statement is currently executing, under the same conditions as `statement.close()`.","examples":[],"children":[]},{"kind":"method","id":"statementstatcounter","name":"stat","title":"`statement.stat(counter)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"counter","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The name of the counter to read. One of:","default":null,"optional":false,"rest":false,"properties":[{"name":"'fullscanStep'","type":null,"description":"The number of times SQLite has stepped forward in a table\nas part of a full table scan.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"'sort'","type":null,"description":"The number of sort operations that have occurred.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"'autoindex'","type":null,"description":"The number of rows inserted into transient indices that were\ncreated automatically to help joins run faster.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"'vmStep'","type":null,"description":"The number of virtual machine operations executed by the\nprepared statement.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"'reprepare'","type":null,"description":"The number of times the statement has been automatically\nreprepared due to schema changes or changes to bound parameters.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"'run'","type":null,"description":"The number of execution cycles started by the prepared statement.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"'filterMiss'","type":null,"description":"The number of times the Bloom filter returned a result that\nrequired the join step to be processed as normal.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"'filterHit'","type":null,"description":"The number of times a join step was bypassed because a Bloom\nfilter returned not-found.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"'memused'","type":null,"description":"The approximate number of bytes of heap memory used to store\nthe prepared statement.","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The current value of the requested counter."}},"description":"Returns one of the runtime counters that SQLite tracks for this prepared\nstatement. This method is a wrapper around [`sqlite3_stmt_status()`](https://www.sqlite.org/c3ref/stmt_status.html) and does\nnot reset the counter. Asserting that a statement does not perform a full table\nscan (`statement.stat('fullscanStep') === 0`) is a useful check to guard\nagainst degenerate performance.\n\nThe `'filterMiss'` and `'filterHit'` counters require SQLite 3.38.0 or later.\nBuilds linked against an older SQLite with `--shared-sqlite` do not expose them,\nand passing either name throws `ERR_INVALID_ARG_VALUE`.","summary":"Returns one of the runtime counters that SQLite tracks for this prepared statement. This method is a wrapper around `sqlite3_stmt_status()` and does not reset the counter. Asserting that a statement does not perform a full table scan (`statement.stat('fullscanStep') === 0`) is a useful check to guard against degenerate performance.","examples":[],"children":[]}]},{"kind":"class","id":"class-sqltagstore","name":"SQLTagStore","title":"Class: `SQLTagStore`","scope":"module","overloadOf":null,"stability":null,"added":["v24.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"This class represents a single LRU (Least Recently Used) cache for storing\nprepared statements.\n\nInstances of this class are created via the [`database.createTagStore()`](#databasecreatetagstoremaxsize)\nmethod, not by using a constructor. The store caches prepared statements based\non the provided SQL query string. When the same query is seen again, the store\nretrieves the cached statement and safely applies the new values through\nparameter binding, thereby preventing attacks like SQL injection.\n\nThe cache has a maxSize that defaults to 1000 statements, but a custom size can\nbe provided (e.g., `database.createTagStore(100)`). All APIs exposed by this\nclass execute synchronously.","summary":"This class represents a single LRU (Least Recently Used) cache for storing prepared statements.","examples":[],"children":[{"kind":"method","id":"sqltagstoreallstringelements-boundparameters","name":"all","title":"`sqlTagStore.all(stringElements[, ...boundParameters])`","scope":"module","overloadOf":null,"stability":null,"added":["v24.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62001","commit":null,"description":"Add support for boolean values in bound parameters."},{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62061","commit":null,"description":"Add support for `ArrayBuffer` and `SharedArrayBuffer` objects in bound parameters."}],"signature":{"parameters":[{"name":"stringElements","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Template literal elements containing the SQL\nquery.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"boundParameters","type":{"text":"null | number | bigint | boolean | string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer","links":[{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":0,"end":4},{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":7,"end":13},{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":16,"end":22},{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":25,"end":32},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":35,"end":41},{"name":"Buffer","href":"buffer.html#class-buffer","start":44,"end":50},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":53,"end":63},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":66,"end":74},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":77,"end":88},{"name":"SharedArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer","start":91,"end":108}]},"description":"Parameter values to be bound to placeholders in the template string.","default":null,"optional":true,"rest":true,"properties":[]}],"returns":{"type":{"text":"Array","links":[{"name":"Array","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array","start":0,"end":5}]},"description":"An array of objects representing the rows returned by the query."}},"description":"Executes the given SQL query and returns all resulting rows as an array of\nobjects.\n\nThis function is intended to be used as a template literal tag, not to be\ncalled directly.","summary":"Executes the given SQL query and returns all resulting rows as an array of objects.","examples":[],"children":[]},{"kind":"method","id":"sqltagstoregetstringelements-boundparameters","name":"get","title":"`sqlTagStore.get(stringElements[, ...boundParameters])`","scope":"module","overloadOf":null,"stability":null,"added":["v24.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62001","commit":null,"description":"Add support for boolean values in bound parameters."},{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62061","commit":null,"description":"Add support for `ArrayBuffer` and `SharedArrayBuffer` objects in bound parameters."}],"signature":{"parameters":[{"name":"stringElements","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Template literal elements containing the SQL\nquery.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"boundParameters","type":{"text":"null | number | bigint | boolean | string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer","links":[{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":0,"end":4},{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":7,"end":13},{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":16,"end":22},{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":25,"end":32},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":35,"end":41},{"name":"Buffer","href":"buffer.html#class-buffer","start":44,"end":50},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":53,"end":63},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":66,"end":74},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":77,"end":88},{"name":"SharedArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer","start":91,"end":108}]},"description":"Parameter values to be bound to placeholders in the template string.","default":null,"optional":true,"rest":true,"properties":[]}],"returns":{"type":{"text":"Object | undefined","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6},{"name":"undefined","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#undefined_type","start":9,"end":18}]},"description":"An object representing the first row returned by\nthe query, or `undefined` if no rows are returned."}},"description":"Executes the given SQL query and returns the first resulting row as an object.\n\nThis function is intended to be used as a template literal tag, not to be\ncalled directly.","summary":"Executes the given SQL query and returns the first resulting row as an object.","examples":[],"children":[]},{"kind":"method","id":"sqltagstoreiteratestringelements-boundparameters","name":"iterate","title":"`sqlTagStore.iterate(stringElements[, ...boundParameters])`","scope":"module","overloadOf":null,"stability":null,"added":["v24.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62001","commit":null,"description":"Add support for boolean values in bound parameters."},{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62061","commit":null,"description":"Add support for `ArrayBuffer` and `SharedArrayBuffer` objects in bound parameters."}],"signature":{"parameters":[{"name":"stringElements","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Template literal elements containing the SQL\nquery.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"boundParameters","type":{"text":"null | number | bigint | boolean | string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer","links":[{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":0,"end":4},{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":7,"end":13},{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":16,"end":22},{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":25,"end":32},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":35,"end":41},{"name":"Buffer","href":"buffer.html#class-buffer","start":44,"end":50},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":53,"end":63},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":66,"end":74},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":77,"end":88},{"name":"SharedArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer","start":91,"end":108}]},"description":"Parameter values to be bound to placeholders in the template string.","default":null,"optional":true,"rest":true,"properties":[]}],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":"An iterator that yields objects representing the rows returned by the query."}},"description":"Executes the given SQL query and returns an iterator over the resulting rows.\n\nThis function is intended to be used as a template literal tag, not to be\ncalled directly.","summary":"Executes the given SQL query and returns an iterator over the resulting rows.","examples":[],"children":[]},{"kind":"method","id":"sqltagstorerunstringelements-boundparameters","name":"run","title":"`sqlTagStore.run(stringElements[, ...boundParameters])`","scope":"module","overloadOf":null,"stability":null,"added":["v24.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62001","commit":null,"description":"Add support for boolean values in bound parameters."},{"versions":["v26.8.0"],"prUrl":"https://github.com/nodejs/node/pull/62061","commit":null,"description":"Add support for `ArrayBuffer` and `SharedArrayBuffer` objects in bound parameters."}],"signature":{"parameters":[{"name":"stringElements","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Template literal elements containing the SQL\nquery.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"boundParameters","type":{"text":"null | number | bigint | boolean | string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer","links":[{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":0,"end":4},{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":7,"end":13},{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":16,"end":22},{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":25,"end":32},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":35,"end":41},{"name":"Buffer","href":"buffer.html#class-buffer","start":44,"end":50},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":53,"end":63},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":66,"end":74},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":77,"end":88},{"name":"SharedArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer","start":91,"end":108}]},"description":"Parameter values to be bound to placeholders in the template string.","default":null,"optional":true,"rest":true,"properties":[]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"An object containing information about the execution, including `changes` and `lastInsertRowid`."}},"description":"Executes the given SQL query, which is expected to not return any rows (e.g., INSERT, UPDATE, DELETE).\n\nThis function is intended to be used as a template literal tag, not to be\ncalled directly.","summary":"Executes the given SQL query, which is expected to not return any rows (e.g., INSERT, UPDATE, DELETE).","examples":[],"children":[]},{"kind":"property","id":"sqltagstoresize","name":"size","title":"`sqlTagStore.size`","scope":"module","overloadOf":null,"stability":null,"added":["v24.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v25.5.0","v24.13.1"],"prUrl":"https://github.com/nodejs/node/pull/60246","commit":null,"description":"Changed from a method to a getter."}],"type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"default":null,"description":"A read-only property that returns the number of prepared statements currently in the cache.","summary":"A read-only property that returns the number of prepared statements currently in the cache.","examples":[],"children":[]},{"kind":"property","id":"sqltagstorecapacity","name":"capacity","title":"`sqlTagStore.capacity`","scope":"module","overloadOf":null,"stability":null,"added":["v24.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"default":null,"description":"A read-only property that returns the maximum number of prepared statements the cache can hold.","summary":"A read-only property that returns the maximum number of prepared statements the cache can hold.","examples":[],"children":[]},{"kind":"property","id":"sqltagstoredb","name":"db","title":"`sqlTagStore.db`","scope":"module","overloadOf":null,"stability":null,"added":["v24.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"DatabaseSync","links":[{"name":"DatabaseSync","href":"sqlite.html#class-databasesync","start":0,"end":12}]},"default":null,"description":"A read-only property that returns the `DatabaseSync` object associated with this `SQLTagStore`.","summary":"A read-only property that returns the `DatabaseSync` object associated with this `SQLTagStore`.","examples":[],"children":[]},{"kind":"method","id":"sqltagstoreclear","name":"clear","title":"`sqlTagStore.clear()`","scope":"module","overloadOf":null,"stability":null,"added":["v24.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Resets the LRU cache, clearing all stored prepared statements.","summary":"Resets the LRU cache, clearing all stored prepared statements.","examples":[],"children":[]}]},{"kind":"method","id":"sqlitebackupsourcedb-path-options","name":"backup","title":"`sqlite.backup(sourceDb, path[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v23.8.0","v22.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v23.10.0"],"prUrl":"https://github.com/nodejs/node/pull/56991","commit":null,"description":"The `path` argument now supports Buffer and URL objects."}],"signature":{"parameters":[{"name":"sourceDb","type":{"text":"DatabaseSync","links":[{"name":"DatabaseSync","href":"sqlite.html#class-databasesync","start":0,"end":12}]},"description":"The database to backup. The source database must be open.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"path","type":{"text":"string | Buffer | URL","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Buffer","href":"buffer.html#class-buffer","start":9,"end":15},{"name":"URL","href":"url.html#the-whatwg-url-api","start":18,"end":21}]},"description":"The path where the backup will be created. If the file already exists,\nthe contents will be overwritten.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Optional configuration for the backup. The\nfollowing properties are supported:","default":null,"optional":true,"rest":false,"properties":[{"name":"source","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Name of the source database. This can be `'main'` (the default primary database) or any other\ndatabase that have been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html)","default":"'main'","optional":true,"rest":false,"properties":[]},{"name":"target","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Name of the target database. This can be `'main'` (the default primary database) or any other\ndatabase that have been added with [`ATTACH DATABASE`](https://www.sqlite.org/lang_attach.html)","default":"'main'","optional":true,"rest":false,"properties":[]},{"name":"rate","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"Positive number of pages to be transmitted in each batch of the backup.","default":"100","optional":true,"rest":false,"properties":[]},{"name":"progress","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"An optional callback function that will be called after each backup step. The argument passed\nto this callback is an {Object} with `remainingPages` and `totalPages` properties, describing the current progress\nof the backup operation.","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":"A promise that fulfills with the total number of backed-up pages upon completion, or rejects if an\nerror occurs."}},"description":"This method makes a database backup. This method abstracts the [`sqlite3_backup_init()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupinit), [`sqlite3_backup_step()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep)\nand [`sqlite3_backup_finish()`](https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupfinish) functions.\n\nThe backed-up database can be used normally during the backup process. Mutations coming from the same connection - same\n{DatabaseSync} - object will be reflected in the backup right away. However, mutations from other connections will cause\nthe backup process to restart.\n\n```cjs\nconst { backup, DatabaseSync } = require('node:sqlite');\n\n(async () => {\n  const sourceDb = new DatabaseSync('source.db');\n  const totalPagesTransferred = await backup(sourceDb, 'backup.db', {\n    rate: 1, // Copy one page at a time.\n    progress: ({ totalPages, remainingPages }) => {\n      console.log('Backup in progress', { totalPages, remainingPages });\n    },\n  });\n\n  console.log('Backup completed', totalPagesTransferred);\n})();\n```\n\n```mjs\nimport { backup, DatabaseSync } from 'node:sqlite';\n\nconst sourceDb = new DatabaseSync('source.db');\nconst totalPagesTransferred = await backup(sourceDb, 'backup.db', {\n  rate: 1, // Copy one page at a time.\n  progress: ({ totalPages, remainingPages }) => {\n    console.log('Backup in progress', { totalPages, remainingPages });\n  },\n});\n\nconsole.log('Backup completed', totalPagesTransferred);\n```","summary":"This method makes a database backup. This method abstracts the `sqlite3_backup_init()`, `sqlite3_backup_step()` and `sqlite3_backup_finish()` functions.","examples":[{"language":"cjs","displayName":null,"code":"const { backup, DatabaseSync } = require('node:sqlite');\n\n(async () => {\n  const sourceDb = new DatabaseSync('source.db');\n  const totalPagesTransferred = await backup(sourceDb, 'backup.db', {\n    rate: 1, // Copy one page at a time.\n    progress: ({ totalPages, remainingPages }) => {\n      console.log('Backup in progress', { totalPages, remainingPages });\n    },\n  });\n\n  console.log('Backup completed', totalPagesTransferred);\n})();"},{"language":"mjs","displayName":null,"code":"import { backup, DatabaseSync } from 'node:sqlite';\n\nconst sourceDb = new DatabaseSync('source.db');\nconst totalPagesTransferred = await backup(sourceDb, 'backup.db', {\n  rate: 1, // Copy one page at a time.\n  progress: ({ totalPages, remainingPages }) => {\n    console.log('Backup in progress', { totalPages, remainingPages });\n  },\n});\n\nconsole.log('Backup completed', totalPagesTransferred);"}],"children":[]},{"kind":"property","id":"sqliteconstants","name":"constants","title":"`sqlite.constants`","scope":"module","overloadOf":null,"stability":null,"added":["v23.5.0","v22.13.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"An object containing commonly used constants for SQLite operations.","summary":"An object containing commonly used constants for SQLite operations.","examples":[],"children":[{"kind":"section","id":"sqlite-constants","name":"SQLite constants","title":"SQLite constants","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The following constants are exported by the `sqlite.constants` object.","summary":"The following constants are exported by the `sqlite.constants` object.","examples":[],"children":[{"kind":"section","id":"conflict-resolution-constants","name":"Conflict resolution constants","title":"Conflict resolution constants","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"One of the following constants is available as an argument to the `onConflict`\nconflict resolution handler passed to [`database.applyChangeset()`](#databaseapplychangesetchangeset-options). See also\n[Constants Passed To The Conflict Handler](https://www.sqlite.org/session/c_changeset_conflict.html) in the SQLite documentation.\n\n<table>\n  <tr>\n    <th>Constant</th>\n    <th>Description</th>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CHANGESET_DATA</code></td>\n    <td>The conflict handler is invoked with this constant when processing a DELETE or UPDATE change if a row with the required PRIMARY KEY fields is present in the database, but one or more other (non primary-key) fields modified by the update do not contain the expected \"before\" values.</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CHANGESET_NOTFOUND</code></td>\n    <td>The conflict handler is invoked with this constant when processing a DELETE or UPDATE change if a row with the required PRIMARY KEY fields is not present in the database.</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CHANGESET_CONFLICT</code></td>\n    <td>This constant is passed to the conflict handler while processing an INSERT change if the operation would result in duplicate primary key values.</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CHANGESET_CONSTRAINT</code></td>\n    <td>If any other constraint violation occurs while applying a change (i.e. a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is invoked with this constant.</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CHANGESET_FOREIGN_KEY</code></td>\n    <td>If foreign key handling is enabled, and applying a changeset leaves the database in a state containing foreign key violations, the conflict handler is invoked with this constant exactly once before the changeset is committed. If the conflict handler returns <code>SQLITE_CHANGESET_OMIT</code>, the changes, including those that caused the foreign key constraint violation, are committed. Or, if it returns <code>SQLITE_CHANGESET_ABORT</code>, the changeset is rolled back.</td>\n  </tr>\n</table>\n\nOne of the following constants must be returned from the `onConflict` conflict\nresolution handler passed to [`database.applyChangeset()`](#databaseapplychangesetchangeset-options). See also\n[Constants Returned From The Conflict Handler](https://www.sqlite.org/session/c_changeset_abort.html) in the SQLite documentation.\n\n<table>\n  <tr>\n    <th>Constant</th>\n    <th>Description</th>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CHANGESET_OMIT</code></td>\n    <td>Conflicting changes are omitted.</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CHANGESET_REPLACE</code></td>\n    <td>Conflicting changes replace existing values. Note that this value can only be returned when the type of conflict is either <code>SQLITE_CHANGESET_DATA</code> or <code>SQLITE_CHANGESET_CONFLICT</code>.</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CHANGESET_ABORT</code></td>\n    <td>Abort when a change encounters a conflict and roll back database.</td>\n  </tr>\n</table>","summary":"One of the following constants is available as an argument to the `onConflict` conflict resolution handler passed to `database.applyChangeset()`. See also Constants Passed To The Conflict Handler in the SQLite documentation.","examples":[],"children":[]},{"kind":"section","id":"authorization-constants","name":"Authorization constants","title":"Authorization constants","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The following constants are used with the [`database.setAuthorizer()`](#databasesetauthorizercallback) method.","summary":"The following constants are used with the `database.setAuthorizer()` method.","examples":[],"children":[{"kind":"section","id":"authorization-result-codes","name":"Authorization result codes","title":"Authorization result codes","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"One of the following constants must be returned from the authorizer callback\nfunction passed to [`database.setAuthorizer()`](#databasesetauthorizercallback).\n\n<table>\n  <tr>\n    <th>Constant</th>\n    <th>Description</th>\n  </tr>\n  <tr>\n    <td><code>SQLITE_OK</code></td>\n    <td>Allow the operation to proceed normally.</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_DENY</code></td>\n    <td>Deny the operation and cause an error to be returned.</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_IGNORE</code></td>\n    <td>Ignore the operation and continue as if it had never been requested.</td>\n  </tr>\n</table>","summary":"One of the following constants must be returned from the authorizer callback function passed to `database.setAuthorizer()`.","examples":[],"children":[]},{"kind":"section","id":"authorization-action-codes","name":"Authorization action codes","title":"Authorization action codes","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The following constants are passed as the first argument to the authorizer\ncallback function to indicate what type of operation is being authorized.\n\n<table>\n  <tr>\n    <th>Constant</th>\n    <th>Description</th>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CREATE_INDEX</code></td>\n    <td>Create an index</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CREATE_TABLE</code></td>\n    <td>Create a table</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CREATE_TEMP_INDEX</code></td>\n    <td>Create a temporary index</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CREATE_TEMP_TABLE</code></td>\n    <td>Create a temporary table</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CREATE_TEMP_TRIGGER</code></td>\n    <td>Create a temporary trigger</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CREATE_TEMP_VIEW</code></td>\n    <td>Create a temporary view</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CREATE_TRIGGER</code></td>\n    <td>Create a trigger</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CREATE_VIEW</code></td>\n    <td>Create a view</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_DELETE</code></td>\n    <td>Delete from a table</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_DROP_INDEX</code></td>\n    <td>Drop an index</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_DROP_TABLE</code></td>\n    <td>Drop a table</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_DROP_TEMP_INDEX</code></td>\n    <td>Drop a temporary index</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_DROP_TEMP_TABLE</code></td>\n    <td>Drop a temporary table</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_DROP_TEMP_TRIGGER</code></td>\n    <td>Drop a temporary trigger</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_DROP_TEMP_VIEW</code></td>\n    <td>Drop a temporary view</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_DROP_TRIGGER</code></td>\n    <td>Drop a trigger</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_DROP_VIEW</code></td>\n    <td>Drop a view</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_INSERT</code></td>\n    <td>Insert into a table</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_PRAGMA</code></td>\n    <td>Execute a PRAGMA statement</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_READ</code></td>\n    <td>Read from a table</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_SELECT</code></td>\n    <td>Execute a SELECT statement</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_TRANSACTION</code></td>\n    <td>Begin, commit, or rollback a transaction</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_UPDATE</code></td>\n    <td>Update a table</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_ATTACH</code></td>\n    <td>Attach a database</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_DETACH</code></td>\n    <td>Detach a database</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_ALTER_TABLE</code></td>\n    <td>Alter a table</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_REINDEX</code></td>\n    <td>Reindex</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_ANALYZE</code></td>\n    <td>Analyze the database</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_CREATE_VTABLE</code></td>\n    <td>Create a virtual table</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_DROP_VTABLE</code></td>\n    <td>Drop a virtual table</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_FUNCTION</code></td>\n    <td>Use a function</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_SAVEPOINT</code></td>\n    <td>Create, release, or rollback a savepoint</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_COPY</code></td>\n    <td>Copy data (legacy)</td>\n  </tr>\n  <tr>\n    <td><code>SQLITE_RECURSIVE</code></td>\n    <td>Recursive query</td>\n  </tr>\n</table>","summary":"The following constants are passed as the first argument to the authorizer callback function to indicate what type of operation is being authorized.","examples":[],"children":[]}]}]}]}]}