Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 08ff16e

Browse filesBrowse files
Renegade334aduh95
authored andcommitted
doc: move sqlite type conversion section to correct level
PR-URL: #62482 Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent ad83094 commit 08ff16e
Copy full SHA for 08ff16e

1 file changed

+23-23Lines changed: 23 additions & 23 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/sqlite.md‎

Copy file name to clipboardExpand all lines: doc/api/sqlite.md
+23-23Lines changed: 23 additions & 23 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -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
@@ -1187,29 +1210,6 @@ added: v24.9.0
11871210

11881211
Resets the LRU cache, clearing all stored prepared statements.
11891212

1190-
### Type conversion between JavaScript and SQLite
1191-
1192-
When Node.js writes to or reads from SQLite, it is necessary to convert between
1193-
JavaScript data types and SQLite's [data types][]. Because JavaScript supports
1194-
more data types than SQLite, only a subset of JavaScript types are supported.
1195-
Attempting to write an unsupported data type to SQLite will result in an
1196-
exception.
1197-
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.
1212-
12131213
## `sqlite.backup(sourceDb, path[, options])`
12141214

12151215
<!-- YAML

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.