Skip to content

Commit 91638ee

Browse files
Renegade334targos
authored andcommitted
doc: clarify sqlite user-defined function behaviour
PR-URL: #56786 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
1 parent 0f553e5 commit 91638ee

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

doc/api/sqlite.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,14 @@ added: v23.5.0
176176
* `useBigIntArguments` {boolean} If `true`, integer arguments to `function`
177177
are converted to `BigInt`s. If `false`, integer arguments are passed as
178178
JavaScript numbers. **Default:** `false`.
179-
* `varargs` {boolean} If `true`, `function` can accept a variable number of
180-
arguments. If `false`, `function` must be invoked with exactly
181-
`function.length` arguments. **Default:** `false`.
179+
* `varargs` {boolean} If `true`, `function` may be invoked with any number of
180+
arguments (between zero and [`SQLITE_MAX_FUNCTION_ARG`][]). If `false`,
181+
`function` must be invoked with exactly `function.length` arguments.
182+
**Default:** `false`.
182183
* `function` {Function} The JavaScript function to call when the SQLite
183-
function is invoked.
184+
function is invoked. The return value of this function should be a valid
185+
SQLite data type: see [Type conversion between JavaScript and SQLite][].
186+
The result defaults to `NULL` if the return value is `undefined`.
184187

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy