@creator-notes/cnotes 0.120.0 → 0.120.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/local-db/ops.js
CHANGED
|
@@ -36,9 +36,10 @@ export function openCopy(db, persistent) {
|
|
|
36
36
|
/**
|
|
37
37
|
* Run one SELECT (or WITH ... SELECT) and return rows as arrays. The caller
|
|
38
38
|
* wraps it in `PRAGMA query_only` where the handle supports it; the text check
|
|
39
|
-
* here is for a readable error, not the guarantee.
|
|
39
|
+
* here is for a readable error, not the guarantee. `deadlineMs` goes to a
|
|
40
|
+
* handle that can interrupt the query (the browser worker); others ignore it.
|
|
40
41
|
*/
|
|
41
|
-
export function runReadOnlySql(db, sql, maxRows) {
|
|
42
|
+
export function runReadOnlySql(db, sql, maxRows, deadlineMs) {
|
|
42
43
|
const checked = checkReadOnlySql(sql);
|
|
43
44
|
if (!checked.ok)
|
|
44
45
|
throw new Error(checked.reason);
|
|
@@ -47,7 +48,7 @@ export function runReadOnlySql(db, sql, maxRows) {
|
|
|
47
48
|
let columns;
|
|
48
49
|
let rows;
|
|
49
50
|
if (db.rows) {
|
|
50
|
-
({ columns, rows } = db.rows(wrapped));
|
|
51
|
+
({ columns, rows } = db.rows(wrapped, [], { deadlineMs }));
|
|
51
52
|
}
|
|
52
53
|
else {
|
|
53
54
|
const objects = db.all(wrapped);
|
|
@@ -101,6 +102,6 @@ export function createLocalDbOps(db) {
|
|
|
101
102
|
}
|
|
102
103
|
return { facets, ms: now() - start };
|
|
103
104
|
},
|
|
104
|
-
sql: ({ sql, maxRows }) => runReadOnlySql(db, sql, maxRows),
|
|
105
|
+
sql: ({ sql, maxRows, deadlineMs }) => runReadOnlySql(db, sql, maxRows, deadlineMs),
|
|
105
106
|
};
|
|
106
107
|
}
|