@@ -1195,19 +1195,26 @@ Resets the LRU cache, clearing all stored prepared statements.
11951195
11961196### Type conversion between JavaScript and SQLite
11971197
1198- When Node.js writes to or reads from SQLite it is necessary to convert between
1198+ When Node.js writes to or reads from SQLite, it is necessary to convert between
11991199JavaScript data types and SQLite's [ data types] [ ] . Because JavaScript supports
12001200more data types than SQLite, only a subset of JavaScript types are supported.
12011201Attempting to write an unsupported data type to SQLite will result in an
12021202exception.
12031203
1204- | SQLite | JavaScript |
1205- | --------- | -------------------------- |
1206- | ` NULL ` | {null} |
1207- | ` INTEGER ` | {number} or {bigint} |
1208- | ` REAL ` | {number} |
1209- | ` TEXT ` | {string} |
1210- | ` BLOB ` | {TypedArray} or {DataView} |
1204+ | Storage class | JavaScript to SQLite | SQLite to JavaScript |
1205+ | ------------- | -------------------------- | ------------------------------------- |
1206+ | ` NULL ` | {null} | {null} |
1207+ | ` INTEGER ` | {number} or {bigint} | {number} or {bigint} _ (configurable)_ |
1208+ | ` REAL ` | {number} | {number} |
1209+ | ` TEXT ` | {string} | {string} |
1210+ | ` BLOB ` | {TypedArray} or {DataView} | {Uint8Array} |
1211+
1212+ APIs that read values from SQLite have a configuration option that determines
1213+ whether ` INTEGER ` values are converted to ` number ` or ` bigint ` in JavaScript,
1214+ such as the ` readBigInts ` option for statements and the ` useBigIntArguments `
1215+ option for user-defined functions. If Node.js reads an ` INTEGER ` value from
1216+ SQLite that is outside the JavaScript [ safe integer] [ ] range, and the option to
1217+ read BigInts is not enabled, then an ` ERR_OUT_OF_RANGE ` error will be thrown.
12111218
12121219## ` sqlite.backup(sourceDb, path[, options]) `
12131220
@@ -1573,3 +1580,4 @@ callback function to indicate what type of operation is being authorized.
15731580[ in memory ] : https://www.sqlite.org/inmemorydb.html
15741581[ parameters are bound ] : https://www.sqlite.org/c3ref/bind_blob.html
15751582[ prepared statement ] : https://www.sqlite.org/c3ref/stmt.html
1583+ [ safe integer ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger
0 commit comments