@@ -155,6 +155,21 @@ changes:
155155 language features that allow ordinary SQL to deliberately corrupt the database file are disabled.
156156 The defensive flag can also be set using ` enableDefensive() ` .
157157 ** Default:** ` false ` .
158+ * ` limits ` {Object} Configuration for various SQLite limits. These limits
159+ can be used to prevent excessive resource consumption when handling
160+ potentially malicious input. See [ Run-Time Limits] [ ] in the SQLite
161+ documentation for details. The following properties are supported:
162+ * ` length ` {number} Maximum length of a string or BLOB.
163+ * ` sqlLength ` {number} Maximum length of an SQL statement.
164+ * ` column ` {number} Maximum number of columns.
165+ * ` exprDepth ` {number} Maximum depth of expression tree.
166+ * ` compoundSelect ` {number} Maximum number of terms in compound SELECT.
167+ * ` vdbeOp ` {number} Maximum number of VDBE instructions.
168+ * ` functionArg ` {number} Maximum number of function arguments.
169+ * ` attach ` {number} Maximum number of attached databases.
170+ * ` likePatternLength ` {number} Maximum length of LIKE pattern.
171+ * ` variableNumber ` {number} Maximum number of SQL variables.
172+ * ` triggerDepth ` {number} Maximum trigger recursion depth.
158173
159174Constructs a new ` DatabaseSync ` instance.
160175
@@ -443,6 +458,31 @@ added:
443458* Type: {boolean} Whether the database is currently within a transaction. This method
444459 is a wrapper around [ ` sqlite3_get_autocommit() ` ] [ ] .
445460
461+ ### ` database.limits `
462+
463+ <!-- YAML
464+ added: REPLACEME
465+ -->
466+
467+ * Type: {Object}
468+
469+ An object for getting and setting SQLite database limits at runtime.
470+ Each property corresponds to an SQLite limit and can be read or written.
471+
472+ ``` js
473+ const db = new DatabaseSync (' :memory:' );
474+
475+ // Read current limit
476+ console .log (db .limits .length );
477+
478+ // Set a new limit
479+ db .limits .sqlLength = 100000 ;
480+ ```
481+
482+ Available properties: ` length ` , ` sqlLength ` , ` column ` , ` exprDepth ` ,
483+ ` compoundSelect ` , ` vdbeOp ` , ` functionArg ` , ` attach ` , ` likePatternLength ` ,
484+ ` variableNumber ` , ` triggerDepth ` .
485+
446486### ` database.open() `
447487
448488<!-- YAML
@@ -1455,6 +1495,7 @@ callback function to indicate what type of operation is being authorized.
14551495[ `ATTACH DATABASE` ] : https://www.sqlite.org/lang_attach.html
14561496[ `PRAGMA foreign_keys` ] : https://www.sqlite.org/pragma.html#pragma_foreign_keys
14571497[ `SQLITE_DBCONFIG_DEFENSIVE` ] : https://www.sqlite.org/c3ref/c_dbconfig_defensive.html#sqlitedbconfigdefensive
1498+ [ Run-Time Limits ] : https://www.sqlite.org/c3ref/limit.html
14581499[ `SQLITE_DETERMINISTIC` ] : https://www.sqlite.org/c3ref/c_deterministic.html
14591500[ `SQLITE_DIRECTONLY` ] : https://www.sqlite.org/c3ref/c_deterministic.html
14601501[ `SQLITE_MAX_FUNCTION_ARG` ] : https://www.sqlite.org/limits.html#max_function_arg
0 commit comments