| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -160,6 +160,23 @@ changes: | |||
| 160 | 160 | language features that allow ordinary SQL to deliberately corrupt the database file are disabled. | |
| 161 | 161 | The defensive flag can also be set using `enableDefensive()`. | |
| 162 | 162 | **Default:** `true`. | |
| 163 | + * `limits` {Object} Configuration for various SQLite limits. These limits | ||
| 164 | + can be used to prevent excessive resource consumption when handling | ||
| 165 | + potentially malicious input. See [Run-Time Limits][] and [Limit Constants][] | ||
| 166 | + in the SQLite documentation for details. Default values are determined by | ||
| 167 | + SQLite's compile-time defaults and may vary depending on how SQLite was | ||
| 168 | + built. The following properties are supported: | ||
| 169 | + * `length` {number} Maximum length of a string or BLOB. | ||
| 170 | + * `sqlLength` {number} Maximum length of an SQL statement. | ||
| 171 | + * `column` {number} Maximum number of columns. | ||
| 172 | + * `exprDepth` {number} Maximum depth of an expression tree. | ||
| 173 | + * `compoundSelect` {number} Maximum number of terms in a compound SELECT. | ||
| 174 | + * `vdbeOp` {number} Maximum number of VDBE instructions. | ||
| 175 | + * `functionArg` {number} Maximum number of function arguments. | ||
| 176 | + * `attach` {number} Maximum number of attached databases. | ||
| 177 | + * `likePatternLength` {number} Maximum length of a LIKE pattern. | ||
| 178 | + * `variableNumber` {number} Maximum number of SQL variables. | ||
| 179 | + * `triggerDepth` {number} Maximum trigger recursion depth. | ||
| 163 | 180 | ||
| 164 | 181 | Constructs a new `DatabaseSync` instance. | |
| 165 | 182 | ||
@@ -447,6 +464,36 @@ added: | |||
| 447 | 464 | * Type: {boolean} Whether the database is currently within a transaction. This method | |
| 448 | 465 | is a wrapper around [`sqlite3_get_autocommit()`][]. | |
| 449 | 466 | ||
| 467 | + ### `database.limits` | ||
| 468 | + | ||
| 469 | + <!-- YAML | ||
| 470 | + added: REPLACEME | ||
| 471 | + --> | ||
| 472 | + | ||
| 473 | + * Type: {Object} | ||
| 474 | + | ||
| 475 | + An object for getting and setting SQLite database limits at runtime. | ||
| 476 | + Each property corresponds to an SQLite limit and can be read or written. | ||
| 477 | + | ||
| 478 | + ```js | ||
| 479 | + const db = new DatabaseSync(':memory:'); | ||
| 480 | + | ||
| 481 | + // Read current limit | ||
| 482 | + console.log(db.limits.length); | ||
| 483 | + | ||
| 484 | + // Set a new limit | ||
| 485 | + db.limits.sqlLength = 100000; | ||
| 486 | + | ||
| 487 | + // Reset a limit to its compile-time maximum | ||
| 488 | + db.limits.sqlLength = Infinity; | ||
| 489 | + ``` | ||
| 490 | + | ||
| 491 | + Available properties: `length`, `sqlLength`, `column`, `exprDepth`, | ||
| 492 | + `compoundSelect`, `vdbeOp`, `functionArg`, `attach`, `likePatternLength`, | ||
| 493 | + `variableNumber`, `triggerDepth`. | ||
| 494 | + | ||
| 495 | + Setting a property to `Infinity` resets the limit to its compile-time maximum value. | ||
| 496 | + | ||
| 450 | 497 | ### `database.open()` | |
| 451 | 498 | ||
| 452 | 499 | <!-- YAML | |
@@ -1472,6 +1519,8 @@ callback function to indicate what type of operation is being authorized. | |||
| 1472 | 1519 | [Changesets and Patchsets]: https://www.sqlite.org/sessionintro.html#changesets_and_patchsets | |
| 1473 | 1520 | [Constants Passed To The Conflict Handler]: https://www.sqlite.org/session/c_changeset_conflict.html | |
| 1474 | 1521 | [Constants Returned From The Conflict Handler]: https://www.sqlite.org/session/c_changeset_abort.html | |
| 1522 | + [Limit Constants]: https://www.sqlite.org/c3ref/c_limit_attached.html | ||
| 1523 | + [Run-Time Limits]: https://www.sqlite.org/c3ref/limit.html | ||
| 1475 | 1524 | [SQL injection]: https://en.wikipedia.org/wiki/SQL_injection | |
| 1476 | 1525 | [Type conversion between JavaScript and SQLite]: #type-conversion-between-javascript-and-sqlite | |
| 1477 | 1526 | [`ATTACH DATABASE`]: https://www.sqlite.org/lang_attach.html | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -237,6 +237,7 @@ | |||
| 237 | 237 | V(kind_string, "kind") \ | |
| 238 | 238 | V(last_insert_rowid_string, "lastInsertRowid") \ | |
| 239 | 239 | V(length_string, "length") \ | |
| 240 | + V(limits_string, "limits") \ | ||
| 240 | 241 | V(library_string, "library") \ | |
| 241 | 242 | V(loop_count, "loopCount") \ | |
| 242 | 243 | V(max_buffer_string, "maxBuffer") \ | |
@@ -435,6 +436,7 @@ | |||
| 435 | 436 | V(socketaddress_constructor_template, v8::FunctionTemplate) \ | |
| 436 | 437 | V(space_stats_template, v8::DictionaryTemplate) \ | |
| 437 | 438 | V(sqlite_column_template, v8::DictionaryTemplate) \ | |
| 439 | + V(sqlite_limits_template, v8::ObjectTemplate) \ | ||
| 438 | 440 | V(sqlite_run_result_template, v8::DictionaryTemplate) \ | |
| 439 | 441 | V(sqlite_statement_sync_constructor_template, v8::FunctionTemplate) \ | |
| 440 | 442 | V(sqlite_statement_sync_iterator_constructor_template, v8::FunctionTemplate) \ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments