@@ -1189,19 +1189,26 @@ Resets the LRU cache, clearing all stored prepared statements.
11891189
11901190### Type conversion between JavaScript and SQLite
11911191
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
11931193JavaScript data types and SQLite's [ data types] [ ] . Because JavaScript supports
11941194more data types than SQLite, only a subset of JavaScript types are supported.
11951195Attempting to write an unsupported data type to SQLite will result in an
11961196exception.
11971197
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.
12051212
12061213## ` sqlite.backup(sourceDb, path[, options]) `
12071214
@@ -1567,3 +1574,4 @@ callback function to indicate what type of operation is being authorized.
15671574[ in memory ] : https://www.sqlite.org/inmemorydb.html
15681575[ parameters are bound ] : https://www.sqlite.org/c3ref/bind_blob.html
15691576[ 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
0 commit comments