@@ -690,19 +690,26 @@ wrapper around [`sqlite3_sql()`][].
690690
691691### Type conversion between JavaScript and SQLite
692692
693- When Node.js writes to or reads from SQLite it is necessary to convert between
693+ When Node.js writes to or reads from SQLite, it is necessary to convert between
694694JavaScript data types and SQLite's [ data types] [ ] . Because JavaScript supports
695695more data types than SQLite, only a subset of JavaScript types are supported.
696696Attempting to write an unsupported data type to SQLite will result in an
697697exception.
698698
699- | SQLite | JavaScript |
700- | --------- | -------------------------- |
701- | ` NULL ` | {null} |
702- | ` INTEGER ` | {number} or {bigint} |
703- | ` REAL ` | {number} |
704- | ` TEXT ` | {string} |
705- | ` BLOB ` | {TypedArray} or {DataView} |
699+ | Storage class | JavaScript to SQLite | SQLite to JavaScript |
700+ | ------------- | -------------------------- | ------------------------------------- |
701+ | ` NULL ` | {null} | {null} |
702+ | ` INTEGER ` | {number} or {bigint} | {number} or {bigint} _ (configurable)_ |
703+ | ` REAL ` | {number} | {number} |
704+ | ` TEXT ` | {string} | {string} |
705+ | ` BLOB ` | {TypedArray} or {DataView} | {Uint8Array} |
706+
707+ APIs that read values from SQLite have a configuration option that determines
708+ whether ` INTEGER ` values are converted to ` number ` or ` bigint ` in JavaScript,
709+ such as the ` readBigInts ` option for statements and the ` useBigIntArguments `
710+ option for user-defined functions. If Node.js reads an ` INTEGER ` value from
711+ SQLite that is outside the JavaScript [ safe integer] [ ] range, and the option to
712+ read BigInts is not enabled, then an ` ERR_OUT_OF_RANGE ` error will be thrown.
706713
707714## ` sqlite.backup(sourceDb, destination[, options]) `
708715
@@ -877,3 +884,4 @@ resolution handler passed to [`database.applyChangeset()`][]. See also
877884[ in memory ] : https://www.sqlite.org/inmemorydb.html
878885[ parameters are bound ] : https://www.sqlite.org/c3ref/bind_blob.html
879886[ prepared statement ] : https://www.sqlite.org/c3ref/stmt.html
887+ [ safe integer ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger
0 commit comments