You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> **Note:** The `changesetInvert()` function for creating inverse changesets is not currently exposed in the JavaScript API. For undo/redo functionality, consider storing the original data before modifications or using SQLite triggers to maintain a history table.
Copy file name to clipboardExpand all lines: doc/extending-sqlite.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -311,20 +311,21 @@ const userPrefs = db
311
311
312
312
### Window Functions
313
313
314
-
Aggregate functions can be used as window functions in SQLite:
314
+
Aggregate functions can be used as window functions in SQLite. For full window function support with framed windows (using `OVER (ORDERBY...)`), you should provide an `inverse` function that reverses the effect of `step`:
315
315
316
316
```javascript
317
-
// Cumulative sum aggregate
317
+
// Cumulative sum aggregate with inverse for window function support
318
318
db.aggregate("cumsum", {
319
319
start:0,
320
320
step: (sum, value) => sum + (value ||0),
321
+
inverse: (sum, value) => sum - (value ||0), // Required for window functions
321
322
});
322
323
323
324
// Use as window function
324
325
constresults= db
325
326
.prepare(
326
327
`
327
-
SELECT
328
+
SELECT
328
329
date,
329
330
amount,
330
331
cumsum(amount) OVER (ORDER BY date) as running_total
@@ -335,6 +336,8 @@ const results = db
335
336
.all(accountId);
336
337
```
337
338
339
+
> **Note:** Without the `inverse` function, the aggregate will still work but may be less efficient for certain window frame types.
340
+
338
341
## Loading Extensions
339
342
340
343
SQLite supports loadable extensions to add functionality at runtime.
Copy file name to clipboardExpand all lines: doc/features.md
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Comprehensive list of features and capabilities in @photostructure/sqlite.
14
14
15
15
## SQLite Version
16
16
17
-
This package includes SQLite 3.50.4 with extensive compile-time options enabled. For complete build flag documentation, comparison with Node.js, and customization options, see [Build Flags & Configuration](./build-flags.md).
17
+
This package includes SQLite 3.51.1 with extensive compile-time options enabled. For complete build flag documentation, comparison with Node.js, and customization options, see [Build Flags & Configuration](./build-flags.md).
18
18
19
19
## Enabled SQLite Features
20
20
@@ -36,8 +36,7 @@ This package includes SQLite 3.50.4 with extensive compile-time options enabled.
36
36
-`SQLITE_ENABLE_RTREE` - R\*Tree spatial indexing
37
37
-`SQLITE_ENABLE_GEOPOLY` - GeoJSON and polygon functions
38
38
-`SQLITE_ENABLE_MATH_FUNCTIONS` - Math functions (sin, cos, sqrt, etc.)
Copy file name to clipboardExpand all lines: doc/internal/worker-implementation.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,10 +22,10 @@ Worker thread support is **fully implemented and working** in @photostructure/sq
22
22
SQLite supports three threading modes:
23
23
24
24
-**Single-thread** (`SQLITE_THREADSAFE=0`): No thread safety, one thread only
25
-
-**Multi-thread** (`SQLITE_THREADSAFE=2`): Multiple threads, separate connections per thread ✅ **CURRENT**
26
-
-**Serialized** (`SQLITE_THREADSAFE=1`): Full thread safety with mutexes (default)
25
+
-**Multi-thread** (`SQLITE_THREADSAFE=2`): Multiple threads, separate connections per thread
26
+
-**Serialized** (`SQLITE_THREADSAFE=1`): Full thread safety with mutexes (default) ✅ **CURRENT**
27
27
28
-
**Current Configuration:** Using `SQLITE_THREADSAFE=2` (multi-thread mode) - the correct choice for worker threads where each thread gets its own database connection.
28
+
**Current Configuration:** Using the default `SQLITE_THREADSAFE=1` (serialized mode). This provides full thread safety with mutex protection, which is safe for worker threads where each thread creates its own database connection.
Copy file name to clipboardExpand all lines: doc/reference/sqlite-api-advanced.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# SQLite Advanced Features API Reference
2
2
3
+
> **⚠️ Important Note:** This documentation describes the **underlying SQLite C library API**, not the JavaScript API exposed by `@photostructure/sqlite`. Most functions documented here (like `sqlite3_blob_open()`, `sqlite3_wal_checkpoint_v2()`) are **NOT directly callable from JavaScript**. Some features like backup and sessions are exposed through the JavaScript API - see [API Reference](../api-reference.md) and [Advanced Patterns](../advanced-patterns.md).
4
+
3
5
This document covers SQLite's advanced APIs including backup operations, blob I/O, sessions, and threading features. This is a machine-generated summary of documentation found on sqlite.org used as a reference during development.
Copy file name to clipboardExpand all lines: doc/reference/sqlite-api-core.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# SQLite Core API Reference
2
2
3
+
> **⚠️ Important Note:** This documentation describes the **underlying SQLite C library API**, not the JavaScript API exposed by `@photostructure/sqlite`. These C functions are **NOT directly callable from JavaScript**. For the JavaScript API, see [API Reference](../api-reference.md).
4
+
3
5
This document covers the fundamental SQLite C/C++ APIs for database connections, basic operations, and error handling. This is a machine-generated summary of documentation found on sqlite.org used as a reference during development.
0 commit comments