diff --git a/doc/api/sqlite.md b/doc/api/sqlite.md index 8a875035f8cb..b5125df4f98d 100644 --- a/doc/api/sqlite.md +++ b/doc/api/sqlite.md @@ -101,7 +101,7 @@ exception. | Storage class | JavaScript to SQLite | SQLite to JavaScript | | ------------- | --------------------------------------------------------------- | ------------------------------------- | -| `NULL` | {null} | {null} | +| `NULL` | {null} or {undefined} | {null} | | `INTEGER` | {number}, {bigint}, or {boolean} | {number} or {bigint} _(configurable)_ | | `REAL` | {number} | {number} | | `TEXT` | {string} | {string} | @@ -113,6 +113,10 @@ values (`1n` and `0n`) when reading BigInts is enabled. Writing a {bigint} that does not fit in a signed 64-bit integer throws an `ERR_INVALID_ARG_VALUE` error. +`undefined` is written as `NULL`, so passing it explicitly is equivalent to +omitting a named parameter. `NULL` always reads back as {null}, never +`undefined`. + APIs that read values from SQLite have a configuration option that determines whether `INTEGER` values are converted to `number` or `bigint` in JavaScript, such as the `readBigInts` option for statements and the `useBigIntArguments` @@ -1089,6 +1093,11 @@ Binding a key that does not name a parameter of the statement throws an `ERR_INVALID_STATE` error unless unknown named parameters are ignored. See [`statement.setAllowUnknownNamedParameters()`][]. +Parameters that are never bound are `NULL`, and binding `undefined` has the same +effect, so `{ $a: undefined }` and `{}` are equivalent. Because `undefined` is +not an object, passing it in place of `namedParameters` binds it as an anonymous +parameter instead. + See [Type conversion between JavaScript and SQLite][] for the values that can be bound. Binding any other value throws an `ERR_INVALID_ARG_TYPE` error. @@ -1097,6 +1106,9 @@ bound. Binding any other value throws an `ERR_INVALID_ARG_TYPE` error.