Skip to content

Commit fc981cd

Browse files
[D1, DO] Clarifying supported SQLite extensions wording (#24837)
* Providing more detail on the SQLite extensions for D1 * Turning it into a partial file for both D1 and DO. * Fixing grammar for partial file * Apply suggestions from code review Co-authored-by: Lambros Petrou <[email protected]> --------- Co-authored-by: Lambros Petrou <[email protected]>
1 parent 85242d3 commit fc981cd

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

src/content/docs/d1/sql-api/sql-statements.mdx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ You can execute any of these statements via the D1 console in the Cloudflare das
1313

1414
## Supported SQLite extensions
1515

16-
D1 supports a subset of SQLite extensions for added functionality, including:
17-
18-
- Default SQLite extensions.
19-
- [FTS5 module](https://www.sqlite.org/fts5.html) for full-text search.
16+
<Render file="d1-do-supported-sqlite-extensions" product="d1" params={{ product: "D1 supports" }}/>
2017

2118
## Compatible PRAGMA statements
2219

src/content/docs/durable-objects/api/storage-api.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class Counter extends DurableObject {
7171

7272
}
7373

74-
````
74+
```
7575
</TypeScriptExample>
7676

7777
JavaScript is a single-threaded and event-driven programming language. This means that JavaScript runtimes, by default, allow requests to interleave with each other which can lead to concurrency bugs. The Durable Objects runtime uses a combination of <GlossaryTooltip term="input gate">input gates</GlossaryTooltip> and <GlossaryTooltip term="output gate">output gates</GlossaryTooltip> to avoid this type of concurrency bug when performing storage operations. Learn more in our [blog post](https://blog.cloudflare.com/durable-objects-easy-fast-correct-choose-three/).
@@ -103,12 +103,14 @@ export class MyDurableObject extends DurableObject {
103103
`);
104104
}
105105
}
106-
````
106+
```
107107

108108
- SQL API methods accessed with `ctx.storage.sql` are only allowed on [Durable Object classes with SQLite storage backend](/durable-objects/best-practices/access-durable-objects-storage/#create-sqlite-backed-durable-object-class) and will return an error if called on Durable Object classes with a key-value storage backend.
109109
- When writing data, every index counts as an additional row. However, indexes may be beneficial for read-heavy use cases. Refer to [Index for SQLite Durable Objects](/durable-objects/best-practices/access-durable-objects-storage/#index-for-sqlite-durable-objects).
110110
- Writing data to [SQLite virtual tables](https://www.sqlite.org/vtab.html) also counts towards rows written.
111111

112+
<Render file="d1-do-supported-sqlite-extensions" product="d1" params={{ product: "Durable Objects support" }}/>
113+
112114
### `exec`
113115

114116
<code>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
params:
3+
- product
4+
---
5+
6+
{props.product} a subset of SQLite extensions for added functionality, including:
7+
8+
- [FTS5 module](https://www.sqlite.org/fts5.html) for full-text search (including `fts5vocab`).
9+
- [JSON extension](https://www.sqlite.org/json1.html) for JSON functions and operators.
10+
- [Math functions](https://sqlite.org/lang_mathfunc.html).
11+
12+
Refer to the [source code](https://github.com/cloudflare/workerd/blob/4c42a4a9d3390c88e9bd977091c9d3395a6cd665/src/workerd/util/sqlite.c%2B%2B#L269) for the full list of supported functions.

0 commit comments

Comments
 (0)