Skip to content

Commit

Permalink
doc: clarify sqlite user-defined function behaviour
Browse files Browse the repository at this point in the history
PR-URL: #56786
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ulises Gascón <[email protected]>
  • Loading branch information
Renegade334 authored and targos committed Feb 2, 2025
1 parent 0f553e5 commit 91638ee
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions doc/api/sqlite.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,14 @@ added: v23.5.0
* `useBigIntArguments` {boolean} If `true`, integer arguments to `function`
are converted to `BigInt`s. If `false`, integer arguments are passed as
JavaScript numbers. **Default:** `false`.
* `varargs` {boolean} If `true`, `function` can accept a variable number of
arguments. If `false`, `function` must be invoked with exactly
`function.length` arguments. **Default:** `false`.
* `varargs` {boolean} If `true`, `function` may be invoked with any number of
arguments (between zero and [`SQLITE_MAX_FUNCTION_ARG`][]). If `false`,
`function` must be invoked with exactly `function.length` arguments.
**Default:** `false`.
* `function` {Function} The JavaScript function to call when the SQLite
function is invoked.
function is invoked. The return value of this function should be a valid
SQLite data type: see [Type conversion between JavaScript and SQLite][].
The result defaults to `NULL` if the return value is `undefined`.

This method is used to create SQLite user-defined functions. This method is a
wrapper around [`sqlite3_create_function_v2()`][].
Expand Down Expand Up @@ -579,10 +582,12 @@ resolution handler passed to [`database.applyChangeset()`][]. See also
[Constants Passed To The Conflict Handler]: https://www.sqlite.org/session/c_changeset_conflict.html
[Constants Returned From The Conflict Handler]: https://www.sqlite.org/session/c_changeset_abort.html
[SQL injection]: https://en.wikipedia.org/wiki/SQL_injection
[Type conversion between JavaScript and SQLite]: #type-conversion-between-javascript-and-sqlite
[`ATTACH DATABASE`]: https://www.sqlite.org/lang_attach.html
[`PRAGMA foreign_keys`]: https://www.sqlite.org/pragma.html#pragma_foreign_keys
[`SQLITE_DETERMINISTIC`]: https://www.sqlite.org/c3ref/c_deterministic.html
[`SQLITE_DIRECTONLY`]: https://www.sqlite.org/c3ref/c_deterministic.html
[`SQLITE_MAX_FUNCTION_ARG`]: https://www.sqlite.org/limits.html#max_function_arg
[`database.applyChangeset()`]: #databaseapplychangesetchangeset-options
[`sqlite3_changes64()`]: https://www.sqlite.org/c3ref/changes.html
[`sqlite3_close_v2()`]: https://www.sqlite.org/c3ref/close.html
Expand Down

0 comments on commit 91638ee

Please sign in to comment.