@@ -1189,19 +1189,26 @@ Resets the LRU cache, clearing all stored prepared statements. |
1189 | 1189 |
|
1190 | 1190 | ### Type conversion between JavaScript and SQLite |
1191 | 1191 |
|
1192 | | -When Node.js writes to or reads from SQLite it is necessary to convert between |
| 1192 | +When Node.js writes to or reads from SQLite, it is necessary to convert between |
1193 | 1193 | JavaScript data types and SQLite's [data types][]. Because JavaScript supports |
1194 | 1194 | more data types than SQLite, only a subset of JavaScript types are supported. |
1195 | 1195 | Attempting to write an unsupported data type to SQLite will result in an |
1196 | 1196 | exception. |
1197 | 1197 |
|
1198 | | -| SQLite | JavaScript | |
1199 | | -| --------- | -------------------------- | |
1200 | | -| `NULL` | {null} | |
1201 | | -| `INTEGER` | {number} or {bigint} | |
1202 | | -| `REAL` | {number} | |
1203 | | -| `TEXT` | {string} | |
1204 | | -| `BLOB` | {TypedArray} or {DataView} | |
| 1198 | +| Storage class | JavaScript to SQLite | SQLite to JavaScript | |
| 1199 | +| ------------- | -------------------------- | ------------------------------------- | |
| 1200 | +| `NULL` | {null} | {null} | |
| 1201 | +| `INTEGER` | {number} or {bigint} | {number} or {bigint} _(configurable)_ | |
| 1202 | +| `REAL` | {number} | {number} | |
| 1203 | +| `TEXT` | {string} | {string} | |
| 1204 | +| `BLOB` | {TypedArray} or {DataView} | {Uint8Array} | |
| 1205 | + |
| 1206 | +APIs that read values from SQLite have a configuration option that determines |
| 1207 | +whether `INTEGER` values are converted to `number` or `bigint` in JavaScript, |
| 1208 | +such as the `readBigInts` option for statements and the `useBigIntArguments` |
| 1209 | +option for user-defined functions. If Node.js reads an `INTEGER` value from |
| 1210 | +SQLite that is outside the JavaScript [safe integer][] range, and the option to |
| 1211 | +read BigInts is not enabled, then an `ERR_OUT_OF_RANGE` error will be thrown. |
1205 | 1212 |
|
1206 | 1213 | ## `sqlite.backup(sourceDb, path[, options])` |
1207 | 1214 |
|
@@ -1567,3 +1574,4 @@ callback function to indicate what type of operation is being authorized. |
1567 | 1574 | [in memory]: https://www.sqlite.org/inmemorydb.html |
1568 | 1575 | [parameters are bound]: https://www.sqlite.org/c3ref/bind_blob.html |
1569 | 1576 | [prepared statement]: https://www.sqlite.org/c3ref/stmt.html |
| 1577 | +[safe integer]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger |