@@ -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
@@ -1173,29 +1196,6 @@ added: v24.9.0
11731196
11741197Resets the LRU cache, clearing all stored prepared statements.
11751198
1176- ### Type conversion between JavaScript and SQLite
1177-
1178- When Node.js writes to or reads from SQLite, it is necessary to convert between
1179- JavaScript data types and SQLite's [ data types] [ ] . Because JavaScript supports
1180- more data types than SQLite, only a subset of JavaScript types are supported.
1181- Attempting to write an unsupported data type to SQLite will result in an
1182- exception.
1183-
1184- | Storage class | JavaScript to SQLite | SQLite to JavaScript |
1185- | ------------- | -------------------------- | ------------------------------------- |
1186- | ` NULL ` | {null} | {null} |
1187- | ` INTEGER ` | {number} or {bigint} | {number} or {bigint} _ (configurable)_ |
1188- | ` REAL ` | {number} | {number} |
1189- | ` TEXT ` | {string} | {string} |
1190- | ` BLOB ` | {TypedArray} or {DataView} | {Uint8Array} |
1191-
1192- APIs that read values from SQLite have a configuration option that determines
1193- whether ` INTEGER ` values are converted to ` number ` or ` bigint ` in JavaScript,
1194- such as the ` readBigInts ` option for statements and the ` useBigIntArguments `
1195- option for user-defined functions. If Node.js reads an ` INTEGER ` value from
1196- SQLite that is outside the JavaScript [ safe integer] [ ] range, and the option to
1197- read BigInts is not enabled, then an ` ERR_OUT_OF_RANGE ` error will be thrown.
1198-
11991199## ` sqlite.backup(sourceDb, path[, options]) `
12001200
12011201<!-- YAML
0 commit comments