@@ -82,6 +82,29 @@ console.log(query.all());
8282// Prints: [ { key: 1, value: 'hello' }, { key: 2, value: 'world' } ]
8383```
8484
85+ ## Type conversion between JavaScript and SQLite
86+
87+ When Node.js writes to or reads from SQLite, it is necessary to convert between
88+ JavaScript data types and SQLite's [ data types] [ ] . Because JavaScript supports
89+ more data types than SQLite, only a subset of JavaScript types are supported.
90+ Attempting to write an unsupported data type to SQLite will result in an
91+ exception.
92+
93+ | Storage class | JavaScript to SQLite | SQLite to JavaScript |
94+ | ------------- | -------------------------- | ------------------------------------- |
95+ | ` NULL ` | {null} | {null} |
96+ | ` INTEGER ` | {number} or {bigint} | {number} or {bigint} _ (configurable)_ |
97+ | ` REAL ` | {number} | {number} |
98+ | ` TEXT ` | {string} | {string} |
99+ | ` BLOB ` | {TypedArray} or {DataView} | {Uint8Array} |
100+
101+ APIs that read values from SQLite have a configuration option that determines
102+ whether ` INTEGER ` values are converted to ` number ` or ` bigint ` in JavaScript,
103+ such as the ` readBigInts ` option for statements and the ` useBigIntArguments `
104+ option for user-defined functions. If Node.js reads an ` INTEGER ` value from
105+ SQLite that is outside the JavaScript [ safe integer] [ ] range, and the option to
106+ read BigInts is not enabled, then an ` ERR_OUT_OF_RANGE ` error will be thrown.
107+
85108## Class: ` DatabaseSync `
86109
87110<!-- YAML
@@ -1193,29 +1216,6 @@ added: v24.9.0
11931216
11941217Resets the LRU cache, clearing all stored prepared statements.
11951218
1196- ### Type conversion between JavaScript and SQLite
1197-
1198- When Node.js writes to or reads from SQLite, it is necessary to convert between
1199- JavaScript data types and SQLite's [ data types] [ ] . Because JavaScript supports
1200- more data types than SQLite, only a subset of JavaScript types are supported.
1201- Attempting to write an unsupported data type to SQLite will result in an
1202- exception.
1203-
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.
1218-
12191219## ` sqlite.backup(sourceDb, path[, options]) `
12201220
12211221<!-- YAML
0 commit comments