@yaks/sqlite 0.0.0-stage → 0.2.36
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/LICENSE +202 -0
- package/README.md +1596 -2
- package/_dist/archetype.d.ts +75 -0
- package/_dist/archetype.d.ts.map +1 -0
- package/_dist/branches.d.ts +23 -0
- package/_dist/branches.d.ts.map +1 -0
- package/_dist/budget.d.ts +52 -0
- package/_dist/budget.d.ts.map +1 -0
- package/_dist/bundle.d.ts +2 -0
- package/_dist/bundle.d.ts.map +1 -0
- package/_dist/cache.d.ts +24 -0
- package/_dist/cache.d.ts.map +1 -0
- package/_dist/catalog.d.ts +9 -0
- package/_dist/catalog.d.ts.map +1 -0
- package/_dist/check.d.ts +4 -0
- package/_dist/check.d.ts.map +1 -0
- package/_dist/db.d.ts +36 -0
- package/_dist/db.d.ts.map +1 -0
- package/_dist/ddl.d.ts +143 -0
- package/_dist/ddl.d.ts.map +1 -0
- package/_dist/doom.d.ts +22 -0
- package/_dist/doom.d.ts.map +1 -0
- package/_dist/follow.d.ts +74 -0
- package/_dist/follow.d.ts.map +1 -0
- package/_dist/history-shapes.d.ts +3 -0
- package/_dist/history-shapes.d.ts.map +1 -0
- package/_dist/history.d.ts +18 -0
- package/_dist/history.d.ts.map +1 -0
- package/_dist/inspect.d.ts +43 -0
- package/_dist/inspect.d.ts.map +1 -0
- package/_dist/jsonb.d.ts +17 -0
- package/_dist/jsonb.d.ts.map +1 -0
- package/_dist/layout.d.ts +7 -0
- package/_dist/layout.d.ts.map +1 -0
- package/_dist/ledger.d.ts +41 -0
- package/_dist/ledger.d.ts.map +1 -0
- package/_dist/meta.d.ts +89 -0
- package/_dist/meta.d.ts.map +1 -0
- package/_dist/migration.d.ts +41 -0
- package/_dist/migration.d.ts.map +1 -0
- package/_dist/mod.d.ts +201 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/mode.d.ts +14 -0
- package/_dist/mode.d.ts.map +1 -0
- package/_dist/overlay.d.ts +30 -0
- package/_dist/overlay.d.ts.map +1 -0
- package/_dist/owe.d.ts +180 -0
- package/_dist/owe.d.ts.map +1 -0
- package/_dist/physical.d.ts +89 -0
- package/_dist/physical.d.ts.map +1 -0
- package/_dist/point.d.ts +10 -0
- package/_dist/point.d.ts.map +1 -0
- package/_dist/raise.d.ts +22 -0
- package/_dist/raise.d.ts.map +1 -0
- package/_dist/read-db.d.ts +9 -0
- package/_dist/read-db.d.ts.map +1 -0
- package/_dist/read-store.d.ts +10 -0
- package/_dist/read-store.d.ts.map +1 -0
- package/_dist/read.d.ts +59 -0
- package/_dist/read.d.ts.map +1 -0
- package/_dist/reader.d.ts +11 -0
- package/_dist/reader.d.ts.map +1 -0
- package/_dist/rules.d.ts +19 -0
- package/_dist/rules.d.ts.map +1 -0
- package/_dist/service.d.ts +12 -0
- package/_dist/service.d.ts.map +1 -0
- package/_dist/shape.d.ts +12 -0
- package/_dist/shape.d.ts.map +1 -0
- package/_dist/statements.d.ts +4 -0
- package/_dist/statements.d.ts.map +1 -0
- package/_dist/survey.d.ts +31 -0
- package/_dist/survey.d.ts.map +1 -0
- package/_dist/tools.d.ts +15 -0
- package/_dist/tools.d.ts.map +1 -0
- package/_dist/trash.d.ts +18 -0
- package/_dist/trash.d.ts.map +1 -0
- package/_dist/unit.d.ts +11 -0
- package/_dist/unit.d.ts.map +1 -0
- package/_dist/vocab.d.ts +6 -0
- package/_dist/vocab.d.ts.map +1 -0
- package/_dist/write.d.ts +169 -0
- package/_dist/write.d.ts.map +1 -0
- package/answer.js +110 -0
- package/answer.js.map +1 -0
- package/answer.ts +122 -0
- package/archetype.js +730 -0
- package/archetype.js.map +1 -0
- package/archetype.ts +790 -0
- package/binary_cases.ts +240 -0
- package/branches.js +195 -0
- package/branches.js.map +1 -0
- package/branches.ts +257 -0
- package/budget.js +89 -0
- package/budget.js.map +1 -0
- package/budget.ts +117 -0
- package/builtin.js +34 -0
- package/builtin.js.map +1 -0
- package/builtin.ts +31 -0
- package/bundle.js +21 -0
- package/bundle.js.map +1 -0
- package/bundle.ts +22 -0
- package/buried.js +95 -0
- package/buried.js.map +1 -0
- package/buried.ts +124 -0
- package/cache.js +153 -0
- package/cache.js.map +1 -0
- package/cache.ts +154 -0
- package/cache_worker.ts +16 -0
- package/catalog.js +173 -0
- package/catalog.js.map +1 -0
- package/catalog.ts +224 -0
- package/check.js +80 -0
- package/check.js.map +1 -0
- package/check.ts +92 -0
- package/checkpoint.js +98 -0
- package/checkpoint.js.map +1 -0
- package/checkpoint.ts +129 -0
- package/checkpoint_worker.ts +37 -0
- package/db.js +170 -0
- package/db.js.map +1 -0
- package/db.ts +173 -0
- package/ddl.js +1441 -0
- package/ddl.js.map +1 -0
- package/ddl.ts +1508 -0
- package/deno.json +1 -0
- package/doom.js +59 -0
- package/doom.js.map +1 -0
- package/doom.ts +75 -0
- package/driver.js +69 -0
- package/driver.js.map +1 -0
- package/driver.ts +101 -0
- package/error.js +30 -0
- package/error.js.map +1 -0
- package/error.ts +46 -0
- package/ffi/LICENSE +202 -0
- package/ffi/blob.js +99 -0
- package/ffi/blob.js.map +1 -0
- package/ffi/blob.ts +156 -0
- package/ffi/constants.js +65 -0
- package/ffi/constants.js.map +1 -0
- package/ffi/constants.ts +67 -0
- package/ffi/database.js +613 -0
- package/ffi/database.js.map +1 -0
- package/ffi/database.ts +931 -0
- package/ffi/ffi.js +535 -0
- package/ffi/ffi.js.map +1 -0
- package/ffi/ffi.ts +604 -0
- package/ffi/mod.js +15 -0
- package/ffi/mod.js.map +1 -0
- package/ffi/mod.ts +28 -0
- package/ffi/statement.js +555 -0
- package/ffi/statement.js.map +1 -0
- package/ffi/statement.ts +788 -0
- package/ffi/util.js +32 -0
- package/ffi/util.js.map +1 -0
- package/ffi/util.ts +48 -0
- package/follow.js +342 -0
- package/follow.js.map +1 -0
- package/follow.ts +401 -0
- package/history-branch.js +166 -0
- package/history-branch.js.map +1 -0
- package/history-branch.ts +140 -0
- package/history-shapes.js +254 -0
- package/history-shapes.js.map +1 -0
- package/history-shapes.ts +268 -0
- package/history.js +620 -0
- package/history.js.map +1 -0
- package/history.ts +674 -0
- package/inspect.js +120 -0
- package/inspect.js.map +1 -0
- package/inspect.ts +164 -0
- package/jsonb.js +73 -0
- package/jsonb.js.map +1 -0
- package/jsonb.ts +108 -0
- package/layout.js +22 -0
- package/layout.js.map +1 -0
- package/layout.ts +26 -0
- package/ledger.js +210 -0
- package/ledger.js.map +1 -0
- package/ledger.ts +210 -0
- package/legacy.js +4 -0
- package/legacy.js.map +1 -0
- package/legacy.ts +3 -0
- package/maintenance.js +148 -0
- package/maintenance.js.map +1 -0
- package/maintenance.ts +154 -0
- package/measure.js +133 -0
- package/measure.js.map +1 -0
- package/measure.ts +167 -0
- package/measure_worker.ts +18 -0
- package/memo.js +1250 -0
- package/memo.js.map +1 -0
- package/memo.ts +1480 -0
- package/meta.js +265 -0
- package/meta.js.map +1 -0
- package/meta.ts +321 -0
- package/migration.js +272 -0
- package/migration.js.map +1 -0
- package/migration.ts +286 -0
- package/mod.js +1103 -0
- package/mod.js.map +1 -0
- package/mod.ts +1762 -0
- package/mode.js +192 -0
- package/mode.js.map +1 -0
- package/mode.ts +207 -0
- package/native.js +544 -0
- package/native.js.map +1 -0
- package/native.ts +544 -0
- package/overlay.js +408 -0
- package/overlay.js.map +1 -0
- package/overlay.ts +485 -0
- package/owe.js +719 -0
- package/owe.js.map +1 -0
- package/owe.ts +873 -0
- package/package.json +99 -4
- package/physical.js +350 -0
- package/physical.js.map +1 -0
- package/physical.ts +434 -0
- package/plan.js +78 -0
- package/plan.js.map +1 -0
- package/plan.ts +104 -0
- package/point.js +81 -0
- package/point.js.map +1 -0
- package/point.ts +52 -0
- package/population.js +639 -0
- package/population.js.map +1 -0
- package/population.ts +630 -0
- package/purge.js +117 -0
- package/purge.js.map +1 -0
- package/purge.ts +127 -0
- package/raise.js +270 -0
- package/raise.js.map +1 -0
- package/raise.ts +316 -0
- package/read-db.js +381 -0
- package/read-db.js.map +1 -0
- package/read-db.ts +282 -0
- package/read-store.js +74 -0
- package/read-store.js.map +1 -0
- package/read-store.ts +86 -0
- package/read.js +1100 -0
- package/read.js.map +1 -0
- package/read.ts +1441 -0
- package/reader.js +141 -0
- package/reader.js.map +1 -0
- package/reader.ts +159 -0
- package/rules.js +88 -0
- package/rules.js.map +1 -0
- package/rules.ts +113 -0
- package/service.js +27 -0
- package/service.js.map +1 -0
- package/service.ts +41 -0
- package/shape.js +76 -0
- package/shape.js.map +1 -0
- package/shape.ts +108 -0
- package/sparse_presence_fixture.ts +45 -0
- package/sqlitepath.js +24 -0
- package/sqlitepath.js.map +1 -0
- package/sqlitepath.ts +29 -0
- package/statements.js +78 -0
- package/statements.js.map +1 -0
- package/statements.ts +96 -0
- package/survey.js +135 -0
- package/survey.js.map +1 -0
- package/survey.ts +196 -0
- package/tools.js +17 -0
- package/tools.js.map +1 -0
- package/tools.ts +50 -0
- package/trash.js +144 -0
- package/trash.js.map +1 -0
- package/trash.ts +187 -0
- package/unit.js +215 -0
- package/unit.js.map +1 -0
- package/unit.ts +211 -0
- package/versions.js +115 -0
- package/versions.js.map +1 -0
- package/versions.ts +110 -0
- package/vocab.js +19 -0
- package/vocab.js.map +1 -0
- package/vocab.json +27 -0
- package/vocab.ts +19 -0
- package/watch.js +33 -0
- package/watch.js.map +1 -0
- package/watch.ts +42 -0
- package/write.js +1164 -0
- package/write.js.map +1 -0
- package/write.ts +1356 -0
- package/written.js +200 -0
- package/written.js.map +1 -0
- package/written.ts +202 -0
package/raise.ts
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
// A component's table is made the first time a write names the component, not
|
|
2
|
+
// when its store installs (D-143541). An empty store holds the spine, the
|
|
3
|
+
// tables a host keeps of its own (blobs, vectors, the journal) and nothing for
|
|
4
|
+
// a word nobody has written; a store holds a table, its indexes and the
|
|
5
|
+
// triggers kept over it only for the words it uses.
|
|
6
|
+
//
|
|
7
|
+
// What belongs to a component is read off the statements themselves, the
|
|
8
|
+
// store's and every one a host keeps beside them, rather than declared twice:
|
|
9
|
+
// a statement **rests on** the component tables it is on, reads or writes,
|
|
10
|
+
// and on whatever the objects it names rest on (a search index on the text
|
|
11
|
+
// view it reads, a trigger on the index it writes). One that rests on no
|
|
12
|
+
// component table is made when the store installs. One that rests on some is
|
|
13
|
+
// made once every table it rests on stands: by the install, over a file that
|
|
14
|
+
// holds them, and otherwise in the transaction of the write that raises the
|
|
15
|
+
// last of them, before that write's rows, so its triggers see them. An object
|
|
16
|
+
// that rests on none but is kept over a component's table (a substring index's
|
|
17
|
+
// list of pieces) is made with the first raised statement that names it,
|
|
18
|
+
// where no install made it.
|
|
19
|
+
//
|
|
20
|
+
// A read of a component with no table answers as one worn by no entity
|
|
21
|
+
// (@yaks/sql `absentDialect`, `absentDerived`).
|
|
22
|
+
|
|
23
|
+
import {
|
|
24
|
+
catalogue,
|
|
25
|
+
type Derived,
|
|
26
|
+
type Driver,
|
|
27
|
+
erect,
|
|
28
|
+
revision,
|
|
29
|
+
type Stmt,
|
|
30
|
+
} from '@yaks/sql/core'
|
|
31
|
+
import { indexed, tabled } from './ddl.js'
|
|
32
|
+
import type { Vocab } from 'jsr:@yaks/vocab@0.2.36'
|
|
33
|
+
import { tables } from './layout.js'
|
|
34
|
+
import { componentTables } from './physical.js'
|
|
35
|
+
import { meta, TABLES, tablesAt } from './meta.js'
|
|
36
|
+
|
|
37
|
+
/** The revision of when a component's objects are made: part of every
|
|
38
|
+
* store's print (./plan.ts), so code that made them all at install finds a
|
|
39
|
+
* store this code made as one it never installed, and makes them. */
|
|
40
|
+
export let RAISED = 1
|
|
41
|
+
|
|
42
|
+
// The component tables every install makes: the graves, and the archetype
|
|
43
|
+
// descriptors and their retirements, which a catalog reads by name before
|
|
44
|
+
// anything is written (./catalog.ts).
|
|
45
|
+
let EAGER = new Set(['tombstone', 'archetype', 'retired'])
|
|
46
|
+
|
|
47
|
+
/** Whether `comp`'s table waits for the first write that names it. */
|
|
48
|
+
export let lazy = (vocab: Vocab, comp: string): boolean =>
|
|
49
|
+
!EAGER.has(comp) && !!vocab.comp(comp) && !vocab.comp(comp)!.computed &&
|
|
50
|
+
comp != 'entity'
|
|
51
|
+
|
|
52
|
+
// Every name a statement is on, reads or writes: a source table, a trigger's
|
|
53
|
+
// or an index's table, a write's target, a virtual table's content.
|
|
54
|
+
let names = (node: unknown, into: Set<string>): Set<string> => {
|
|
55
|
+
if (Array.isArray(node)) {
|
|
56
|
+
for (let n of node) names(n, into)
|
|
57
|
+
return into
|
|
58
|
+
}
|
|
59
|
+
if (!node || typeof node != 'object') return into
|
|
60
|
+
let o = node as Record<string, unknown>
|
|
61
|
+
if (o.t == 'raw' || o.t == 'val' || o.t == 'lit') return into
|
|
62
|
+
if (o.t == 'table' && !o.args) into.add(String(o.name))
|
|
63
|
+
if (o.t == 'create trigger' || o.t == 'create index') into.add(String(o.on))
|
|
64
|
+
if (o.t == 'insert') into.add(String(o.into))
|
|
65
|
+
if (o.t == 'update') into.add(String(o.table))
|
|
66
|
+
if (o.t == 'delete' && typeof o.from == 'string') into.add(o.from)
|
|
67
|
+
if (o.t == 'drop') into.add(String(o.name))
|
|
68
|
+
if (o.t == 'create virtual table') {
|
|
69
|
+
for (let a of o.args as unknown[]) {
|
|
70
|
+
if (Array.isArray(a) && a[0] == 'content') into.add(String(a[1]))
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
for (let v of Object.values(o)) names(v, into)
|
|
74
|
+
return into
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let mentioned = new WeakMap<Stmt, ReadonlySet<string>>()
|
|
78
|
+
let mentions = (stmt: Stmt): ReadonlySet<string> => {
|
|
79
|
+
let found = mentioned.get(stmt)
|
|
80
|
+
if (!found) mentioned.set(stmt, found = names(stmt, new Set()))
|
|
81
|
+
return found
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// A store's own schema and what its host keeps beside it, as one list per
|
|
85
|
+
// vocabulary, read overrides, file and host list: a Vocab is a value nobody
|
|
86
|
+
// mutates once loaded, so a process works out what rests on what once.
|
|
87
|
+
let NONE: Derived = {}
|
|
88
|
+
let schemas = new WeakMap<Vocab, WeakMap<Derived, Stmt[][]>>()
|
|
89
|
+
let joined = new WeakMap<readonly Stmt[], WeakMap<readonly Stmt[], Stmt[]>>()
|
|
90
|
+
|
|
91
|
+
/** Everything a component's first write may make in a store of `vocab`: its
|
|
92
|
+
* own schema (./ddl.ts `tabled`, `indexed`) and `over`, what its host keeps
|
|
93
|
+
* beside it. The same list comes back for the same arguments. */
|
|
94
|
+
export let units = (
|
|
95
|
+
vocab: Vocab,
|
|
96
|
+
derived: Derived = NONE,
|
|
97
|
+
file = false,
|
|
98
|
+
over: readonly Stmt[] = [],
|
|
99
|
+
): Stmt[] => {
|
|
100
|
+
let by = schemas.get(vocab) ?? new WeakMap<Derived, Stmt[][]>()
|
|
101
|
+
schemas.set(vocab, by)
|
|
102
|
+
let held = by.get(derived) ?? []
|
|
103
|
+
by.set(derived, held)
|
|
104
|
+
let own = held[Number(file)] ??= [
|
|
105
|
+
...tabled(vocab, derived, file),
|
|
106
|
+
...indexed(vocab),
|
|
107
|
+
]
|
|
108
|
+
if (!over.length) return own
|
|
109
|
+
let beside = joined.get(own) ?? new WeakMap<readonly Stmt[], Stmt[]>()
|
|
110
|
+
joined.set(own, beside)
|
|
111
|
+
let all = beside.get(over)
|
|
112
|
+
if (!all) beside.set(over, all = [...own, ...over])
|
|
113
|
+
return all
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
let rested = new WeakMap<Vocab, WeakMap<readonly Stmt[], string[][]>>()
|
|
117
|
+
|
|
118
|
+
/** The component tables each of `stmts` rests on, in order: the ones it
|
|
119
|
+
* names, and the ones every object it names that another of `stmts` makes
|
|
120
|
+
* rests on. */
|
|
121
|
+
export let rests = (vocab: Vocab, stmts: readonly Stmt[]): string[][] => {
|
|
122
|
+
let by = rested.get(vocab) ?? new WeakMap<readonly Stmt[], string[][]>()
|
|
123
|
+
rested.set(vocab, by)
|
|
124
|
+
let known = by.get(stmts)
|
|
125
|
+
if (known) return known
|
|
126
|
+
let makers = new Map<string, number>()
|
|
127
|
+
stmts.forEach((s, i) => {
|
|
128
|
+
if (s.t.startsWith('create ') && 'name' in s) makers.set(s.name, i)
|
|
129
|
+
})
|
|
130
|
+
let memo = new Map<number, Set<string>>()
|
|
131
|
+
let of = (i: number): Set<string> => {
|
|
132
|
+
let held = memo.get(i)
|
|
133
|
+
if (held) return held
|
|
134
|
+
let found = new Set<string>()
|
|
135
|
+
memo.set(i, found)
|
|
136
|
+
let s = stmts[i]
|
|
137
|
+
let made = s.t.startsWith('create ') && 'name' in s ? s.name : null
|
|
138
|
+
// A component's own table rests on itself.
|
|
139
|
+
if (made != null && lazy(vocab, made)) found.add(made)
|
|
140
|
+
for (let n of mentions(s)) {
|
|
141
|
+
if (lazy(vocab, n)) found.add(n)
|
|
142
|
+
let maker = makers.get(n)
|
|
143
|
+
if (n != made && maker != null) { for (let c of of(maker)) found.add(c) }
|
|
144
|
+
}
|
|
145
|
+
return found
|
|
146
|
+
}
|
|
147
|
+
let all = stmts.map((_, i) => [...of(i)])
|
|
148
|
+
by.set(stmts, all)
|
|
149
|
+
return all
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// What the file's receipt says, per schema revision: a write that raises a
|
|
153
|
+
// table moves the schema and the receipt in one transaction.
|
|
154
|
+
let receipts = new WeakMap<Driver, { at: number; held?: Set<string> }>()
|
|
155
|
+
|
|
156
|
+
/** The component tables the file holds, as its receipt says (./meta.ts
|
|
157
|
+
* `TABLES`), one row; undefined where no install of this code recorded one,
|
|
158
|
+
* a file whose install made every table. */
|
|
159
|
+
let held = (driver: Driver): Set<string> | undefined => {
|
|
160
|
+
let at = revision(driver, 'schema')
|
|
161
|
+
let k = receipts.get(driver)
|
|
162
|
+
if (k?.at !== at) {
|
|
163
|
+
let said = tablesAt(driver)
|
|
164
|
+
receipts.set(driver, k = { at, held: said && new Set(said) })
|
|
165
|
+
}
|
|
166
|
+
return k.held
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** Record the component tables the file holds now, in its receipt: what an
|
|
170
|
+
* install does once its tables stand. */
|
|
171
|
+
export let recorded = (driver: Driver): void => {
|
|
172
|
+
let found = componentTables(driver)
|
|
173
|
+
meta(driver).set(TABLES, found.join(' '))
|
|
174
|
+
receipts.set(driver, {
|
|
175
|
+
at: revision(driver, 'schema'),
|
|
176
|
+
held: new Set(found),
|
|
177
|
+
})
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// What the file holds of a vocabulary's tables, for each receipt the file
|
|
181
|
+
// has (`held`): every write and read asks it, and only a statement moving the
|
|
182
|
+
// schema or a receipt recorded changes it. The lists are frozen, since every
|
|
183
|
+
// caller is handed the same one.
|
|
184
|
+
type Standing = {
|
|
185
|
+
raised: ReadonlySet<string>
|
|
186
|
+
unraised: string[]
|
|
187
|
+
stood: string[]
|
|
188
|
+
}
|
|
189
|
+
let standings = new WeakMap<
|
|
190
|
+
Driver,
|
|
191
|
+
{ at: number; all?: Set<string>; by: WeakMap<Vocab, Standing> }
|
|
192
|
+
>()
|
|
193
|
+
let standing = (driver: Driver, vocab: Vocab): Standing => {
|
|
194
|
+
let all = held(driver)
|
|
195
|
+
let at = revision(driver, 'schema')
|
|
196
|
+
let k = standings.get(driver)
|
|
197
|
+
if (k?.at !== at || k.all !== all) {
|
|
198
|
+
standings.set(driver, k = { at, all, by: new WeakMap() })
|
|
199
|
+
}
|
|
200
|
+
let got = k.by.get(vocab)
|
|
201
|
+
if (!got) {
|
|
202
|
+
let names = tables(vocab)
|
|
203
|
+
// Main's receipt can omit a table first raised under a branch's words.
|
|
204
|
+
// A mode also sees the tables already present in the shared schema.
|
|
205
|
+
let present = driver.views && all
|
|
206
|
+
? new Set([...all, ...componentTables(driver, [...all], names)])
|
|
207
|
+
: all
|
|
208
|
+
let raised = new Set(
|
|
209
|
+
names.filter((c) => lazy(vocab, c) && (!present || present.has(c))),
|
|
210
|
+
)
|
|
211
|
+
got = {
|
|
212
|
+
raised,
|
|
213
|
+
unraised: Object.freeze(
|
|
214
|
+
names.filter((c) => lazy(vocab, c) && !raised.has(c)),
|
|
215
|
+
) as string[],
|
|
216
|
+
stood: Object.freeze(
|
|
217
|
+
names.filter((c) => !lazy(vocab, c) || raised.has(c)),
|
|
218
|
+
) as string[],
|
|
219
|
+
}
|
|
220
|
+
k.by.set(vocab, got)
|
|
221
|
+
}
|
|
222
|
+
return got
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** The tables of `vocab` raised on a first write that this file holds. */
|
|
226
|
+
export let raisedIn = (driver: Driver, vocab: Vocab): Set<string> =>
|
|
227
|
+
new Set(standing(driver, vocab).raised)
|
|
228
|
+
|
|
229
|
+
/** The components of `vocab` whose table waits for a first write. */
|
|
230
|
+
export let unraised = (driver: Driver, vocab: Vocab): string[] =>
|
|
231
|
+
standing(driver, vocab).unraised
|
|
232
|
+
|
|
233
|
+
/** The tables of `vocab` this file holds. */
|
|
234
|
+
export let stood = (driver: Driver, vocab: Vocab): string[] =>
|
|
235
|
+
standing(driver, vocab).stood
|
|
236
|
+
|
|
237
|
+
/** Those of `stmts` that rest on no table this file lacks, as its schema
|
|
238
|
+
* says: what an install makes, before any receipt is recorded. */
|
|
239
|
+
export let holds = (
|
|
240
|
+
driver: Driver,
|
|
241
|
+
vocab: Vocab,
|
|
242
|
+
stmts: readonly Stmt[],
|
|
243
|
+
): Stmt[] => {
|
|
244
|
+
let on = rests(vocab, stmts)
|
|
245
|
+
if (on.every((r) => !r.length)) return [...stmts]
|
|
246
|
+
let stands = new Set(componentTables(driver))
|
|
247
|
+
return stmts.filter((_, i) => on[i].every((c) => stands.has(c)))
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Those of `stmts` that rest on no component table, make an object one of
|
|
251
|
+
// `raised` names, and the file lacks: what a host keeps over a component's
|
|
252
|
+
// table for it alone (a substring index's list of pieces) stands once the
|
|
253
|
+
// component's first write does, as what rests on the component does.
|
|
254
|
+
let unmade = (
|
|
255
|
+
driver: Driver,
|
|
256
|
+
stmts: readonly Stmt[],
|
|
257
|
+
on: string[][],
|
|
258
|
+
raised: Stmt[],
|
|
259
|
+
): Stmt[] => {
|
|
260
|
+
let made = (s: Stmt) =>
|
|
261
|
+
s.t.startsWith('create ') && 'name' in s ? s.name : null
|
|
262
|
+
let alone = stmts.filter((s, i) => !on[i].length && made(s) != null)
|
|
263
|
+
if (!alone.length) return []
|
|
264
|
+
let named = new Set<string>()
|
|
265
|
+
for (let stmt of raised) {
|
|
266
|
+
for (let name of mentions(stmt)) named.add(name)
|
|
267
|
+
}
|
|
268
|
+
let held = new Set(catalogue(driver).map((o) => o.name))
|
|
269
|
+
return alone.filter((s) => named.has(made(s)!) && !held.has(made(s)!))
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// The schema revisions a run of raises on one connection moved through, the
|
|
273
|
+
// first of them where the run began: what moved the schema and nothing else.
|
|
274
|
+
let runs = new WeakMap<Driver, number[]>()
|
|
275
|
+
|
|
276
|
+
/** Whether raises alone moved this connection's schema from revision `from`
|
|
277
|
+
* to `to`, so a look at the file taken at `from` stands for all but the
|
|
278
|
+
* tables they made. */
|
|
279
|
+
export let raisedOnly = (driver: Driver, from: number, to: number): boolean => {
|
|
280
|
+
let run = runs.get(driver)
|
|
281
|
+
return !!run && run.includes(from) && run.at(-1) == to
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Make the tables of `comps` this file lacks, and every one of `stmts` that
|
|
286
|
+
* rests on one of them and on no table still missing, in their order. Answers
|
|
287
|
+
* the components it made a table for. Run it in the transaction of the write
|
|
288
|
+
* that names them, before that write.
|
|
289
|
+
*/
|
|
290
|
+
export let raise = (
|
|
291
|
+
driver: Driver,
|
|
292
|
+
vocab: Vocab,
|
|
293
|
+
comps: Iterable<string>,
|
|
294
|
+
stmts: readonly Stmt[],
|
|
295
|
+
): string[] => {
|
|
296
|
+
let stands = raisedIn(driver, vocab)
|
|
297
|
+
let fresh = [...new Set(comps)].filter((c) =>
|
|
298
|
+
lazy(vocab, c) && !stands.has(c)
|
|
299
|
+
)
|
|
300
|
+
if (!fresh.length) return []
|
|
301
|
+
for (let c of fresh) stands.add(c)
|
|
302
|
+
let made = new Set(fresh)
|
|
303
|
+
let from = revision(driver, 'schema')
|
|
304
|
+
let on = rests(vocab, stmts)
|
|
305
|
+
let raised = stmts.filter((_, i) =>
|
|
306
|
+
on[i].some((c) => made.has(c)) && on[i].every((c) => stands.has(c))
|
|
307
|
+
)
|
|
308
|
+
erect(driver, [...unmade(driver, stmts, on, raised), ...raised])
|
|
309
|
+
let now = new Set([...held(driver) ?? componentTables(driver), ...fresh])
|
|
310
|
+
meta(driver).set(TABLES, [...now].sort().join(' '))
|
|
311
|
+
let to = revision(driver, 'schema')
|
|
312
|
+
receipts.set(driver, { at: to, held: now })
|
|
313
|
+
let run = runs.get(driver)
|
|
314
|
+
runs.set(driver, run?.at(-1) == from ? [...run, to] : [from, to])
|
|
315
|
+
return fresh
|
|
316
|
+
}
|
package/read-db.js
ADDED
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
// The file reader binds only SQLite's connection, statement and value API.
|
|
2
|
+
// It shares the Driver boundary with the writer, without loading callbacks,
|
|
3
|
+
// database images or the writer's native wrapper. Extensions can read existing
|
|
4
|
+
// indexes; SQLite's read-only handle refuses any metadata they try to write.
|
|
5
|
+
import { sqlitePath } from "./sqlitepath.js";
|
|
6
|
+
import { driver } from "./driver.js";
|
|
7
|
+
import { meter } from "./budget.js";
|
|
8
|
+
let bind = ()=>Deno.dlopen(sqlitePath, {
|
|
9
|
+
sqlite3_open_v2: {
|
|
10
|
+
parameters: [
|
|
11
|
+
'buffer',
|
|
12
|
+
'buffer',
|
|
13
|
+
'i32',
|
|
14
|
+
'pointer'
|
|
15
|
+
],
|
|
16
|
+
result: 'i32'
|
|
17
|
+
},
|
|
18
|
+
sqlite3_close: {
|
|
19
|
+
parameters: [
|
|
20
|
+
'pointer'
|
|
21
|
+
],
|
|
22
|
+
result: 'i32'
|
|
23
|
+
},
|
|
24
|
+
sqlite3_db_config: {
|
|
25
|
+
parameters: [
|
|
26
|
+
'pointer',
|
|
27
|
+
'i32',
|
|
28
|
+
'i32',
|
|
29
|
+
'pointer'
|
|
30
|
+
],
|
|
31
|
+
result: 'i32'
|
|
32
|
+
},
|
|
33
|
+
sqlite3_busy_timeout: {
|
|
34
|
+
parameters: [
|
|
35
|
+
'pointer',
|
|
36
|
+
'i32'
|
|
37
|
+
],
|
|
38
|
+
result: 'i32'
|
|
39
|
+
},
|
|
40
|
+
// Optional: Apple's system libsqlite3 is built without it.
|
|
41
|
+
sqlite3_load_extension: {
|
|
42
|
+
parameters: [
|
|
43
|
+
'pointer',
|
|
44
|
+
'buffer',
|
|
45
|
+
'pointer',
|
|
46
|
+
'pointer'
|
|
47
|
+
],
|
|
48
|
+
result: 'i32',
|
|
49
|
+
optional: true
|
|
50
|
+
},
|
|
51
|
+
sqlite3_errmsg: {
|
|
52
|
+
parameters: [
|
|
53
|
+
'pointer'
|
|
54
|
+
],
|
|
55
|
+
result: 'pointer'
|
|
56
|
+
},
|
|
57
|
+
sqlite3_prepare_v2: {
|
|
58
|
+
parameters: [
|
|
59
|
+
'pointer',
|
|
60
|
+
'buffer',
|
|
61
|
+
'i32',
|
|
62
|
+
'buffer',
|
|
63
|
+
'buffer'
|
|
64
|
+
],
|
|
65
|
+
result: 'i32'
|
|
66
|
+
},
|
|
67
|
+
sqlite3_stmt_readonly: {
|
|
68
|
+
parameters: [
|
|
69
|
+
'pointer'
|
|
70
|
+
],
|
|
71
|
+
result: 'i32'
|
|
72
|
+
},
|
|
73
|
+
sqlite3_stmt_status: {
|
|
74
|
+
parameters: [
|
|
75
|
+
'pointer',
|
|
76
|
+
'i32',
|
|
77
|
+
'i32'
|
|
78
|
+
],
|
|
79
|
+
result: 'i32'
|
|
80
|
+
},
|
|
81
|
+
sqlite3_bind_parameter_count: {
|
|
82
|
+
parameters: [
|
|
83
|
+
'pointer'
|
|
84
|
+
],
|
|
85
|
+
result: 'i32'
|
|
86
|
+
},
|
|
87
|
+
sqlite3_bind_null: {
|
|
88
|
+
parameters: [
|
|
89
|
+
'pointer',
|
|
90
|
+
'i32'
|
|
91
|
+
],
|
|
92
|
+
result: 'i32'
|
|
93
|
+
},
|
|
94
|
+
sqlite3_bind_int64: {
|
|
95
|
+
parameters: [
|
|
96
|
+
'pointer',
|
|
97
|
+
'i32',
|
|
98
|
+
'i64'
|
|
99
|
+
],
|
|
100
|
+
result: 'i32'
|
|
101
|
+
},
|
|
102
|
+
sqlite3_bind_double: {
|
|
103
|
+
parameters: [
|
|
104
|
+
'pointer',
|
|
105
|
+
'i32',
|
|
106
|
+
'f64'
|
|
107
|
+
],
|
|
108
|
+
result: 'i32'
|
|
109
|
+
},
|
|
110
|
+
sqlite3_bind_text: {
|
|
111
|
+
parameters: [
|
|
112
|
+
'pointer',
|
|
113
|
+
'i32',
|
|
114
|
+
'buffer',
|
|
115
|
+
'i32',
|
|
116
|
+
'pointer'
|
|
117
|
+
],
|
|
118
|
+
result: 'i32'
|
|
119
|
+
},
|
|
120
|
+
sqlite3_bind_blob: {
|
|
121
|
+
parameters: [
|
|
122
|
+
'pointer',
|
|
123
|
+
'i32',
|
|
124
|
+
'buffer',
|
|
125
|
+
'i32',
|
|
126
|
+
'pointer'
|
|
127
|
+
],
|
|
128
|
+
result: 'i32'
|
|
129
|
+
},
|
|
130
|
+
sqlite3_step: {
|
|
131
|
+
parameters: [
|
|
132
|
+
'pointer'
|
|
133
|
+
],
|
|
134
|
+
result: 'i32'
|
|
135
|
+
},
|
|
136
|
+
sqlite3_reset: {
|
|
137
|
+
parameters: [
|
|
138
|
+
'pointer'
|
|
139
|
+
],
|
|
140
|
+
result: 'i32'
|
|
141
|
+
},
|
|
142
|
+
sqlite3_clear_bindings: {
|
|
143
|
+
parameters: [
|
|
144
|
+
'pointer'
|
|
145
|
+
],
|
|
146
|
+
result: 'i32'
|
|
147
|
+
},
|
|
148
|
+
sqlite3_finalize: {
|
|
149
|
+
parameters: [
|
|
150
|
+
'pointer'
|
|
151
|
+
],
|
|
152
|
+
result: 'i32'
|
|
153
|
+
},
|
|
154
|
+
sqlite3_column_count: {
|
|
155
|
+
parameters: [
|
|
156
|
+
'pointer'
|
|
157
|
+
],
|
|
158
|
+
result: 'i32'
|
|
159
|
+
},
|
|
160
|
+
sqlite3_column_name: {
|
|
161
|
+
parameters: [
|
|
162
|
+
'pointer',
|
|
163
|
+
'i32'
|
|
164
|
+
],
|
|
165
|
+
result: 'pointer'
|
|
166
|
+
},
|
|
167
|
+
sqlite3_column_type: {
|
|
168
|
+
parameters: [
|
|
169
|
+
'pointer',
|
|
170
|
+
'i32'
|
|
171
|
+
],
|
|
172
|
+
result: 'i32'
|
|
173
|
+
},
|
|
174
|
+
sqlite3_column_int64: {
|
|
175
|
+
parameters: [
|
|
176
|
+
'pointer',
|
|
177
|
+
'i32'
|
|
178
|
+
],
|
|
179
|
+
result: 'i64'
|
|
180
|
+
},
|
|
181
|
+
sqlite3_column_double: {
|
|
182
|
+
parameters: [
|
|
183
|
+
'pointer',
|
|
184
|
+
'i32'
|
|
185
|
+
],
|
|
186
|
+
result: 'f64'
|
|
187
|
+
},
|
|
188
|
+
sqlite3_column_text: {
|
|
189
|
+
parameters: [
|
|
190
|
+
'pointer',
|
|
191
|
+
'i32'
|
|
192
|
+
],
|
|
193
|
+
result: 'pointer'
|
|
194
|
+
},
|
|
195
|
+
sqlite3_column_blob: {
|
|
196
|
+
parameters: [
|
|
197
|
+
'pointer',
|
|
198
|
+
'i32'
|
|
199
|
+
],
|
|
200
|
+
result: 'pointer'
|
|
201
|
+
},
|
|
202
|
+
sqlite3_column_bytes: {
|
|
203
|
+
parameters: [
|
|
204
|
+
'pointer',
|
|
205
|
+
'i32'
|
|
206
|
+
],
|
|
207
|
+
result: 'i32'
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
let api;
|
|
211
|
+
let library = ()=>(api ??= bind()).symbols;
|
|
212
|
+
/** Whether this process's SQLite library can load extensions. A connection
|
|
213
|
+
* offers `extension` only where it can, so storage on a library without it
|
|
214
|
+
* (macOS's own) has no vector facility rather than failing to open. */ export let loadable = ()=>!!library().sqlite3_load_extension;
|
|
215
|
+
let encoder = new TextEncoder(), decoder = new TextDecoder();
|
|
216
|
+
let cstring = (s)=>encoder.encode(s + '\0');
|
|
217
|
+
let pointer = (p)=>p[0] ? Deno.UnsafePointer.create(p[0]) : null;
|
|
218
|
+
let text = (p)=>p ? new Deno.UnsafePointerView(p).getCString() : '';
|
|
219
|
+
// SQLITE_TRANSIENT makes SQLite own copies of bound strings and blobs.
|
|
220
|
+
let transient = Deno.UnsafePointer.create(0xffffffffffffffffn);
|
|
221
|
+
let empty = new Uint8Array(1);
|
|
222
|
+
/** Open an existing SQLite file for reading, without changing journal
|
|
223
|
+
* settings or attempting a checkpoint when its last reader closes. Queries
|
|
224
|
+
* use the same SQL AST, snapshots and tracing as the writable driver, and every
|
|
225
|
+
* row decoded counts against the read running (./budget.ts). */ export let open = (path)=>{
|
|
226
|
+
let c = library();
|
|
227
|
+
let handle = new BigUint64Array(1);
|
|
228
|
+
let rc = c.sqlite3_open_v2(cstring(path), handle, 1, null) // SQLITE_OPEN_READONLY
|
|
229
|
+
;
|
|
230
|
+
let db = pointer(handle);
|
|
231
|
+
let error = ()=>new Error(db ? text(c.sqlite3_errmsg(db)) : `SQLite error ${rc}`);
|
|
232
|
+
if (rc) {
|
|
233
|
+
let failure = error();
|
|
234
|
+
if (db) c.sqlite3_close(db);
|
|
235
|
+
throw failure;
|
|
236
|
+
}
|
|
237
|
+
let check = (code)=>{
|
|
238
|
+
if (code) throw error();
|
|
239
|
+
};
|
|
240
|
+
let cache = new Map();
|
|
241
|
+
let closed = false;
|
|
242
|
+
let checkOpen = ()=>{
|
|
243
|
+
if (closed) throw new Error('the database is closed');
|
|
244
|
+
};
|
|
245
|
+
let close = ()=>{
|
|
246
|
+
if (closed) return;
|
|
247
|
+
for (let { stmt } of cache.values())c.sqlite3_finalize(stmt);
|
|
248
|
+
cache.clear();
|
|
249
|
+
check(c.sqlite3_close(db));
|
|
250
|
+
closed = true;
|
|
251
|
+
};
|
|
252
|
+
try {
|
|
253
|
+
check(c.sqlite3_db_config(db, 1006, 1, null)); // NO_CKPT_ON_CLOSE
|
|
254
|
+
check(c.sqlite3_db_config(db, 1002, 1, null)); // ENABLE_FKEY
|
|
255
|
+
check(c.sqlite3_busy_timeout(db, path == ':memory:' ? 0 : 60_000));
|
|
256
|
+
let prepare = (sql)=>{
|
|
257
|
+
let bytes = cstring(sql), out = new BigUint64Array(1), tail = new BigUint64Array(1);
|
|
258
|
+
check(c.sqlite3_prepare_v2(db, bytes, bytes.length, out, tail));
|
|
259
|
+
let stmt = pointer(out);
|
|
260
|
+
if (!stmt) throw new Error('SQLite expected a statement');
|
|
261
|
+
if (text(pointer(tail)).trim() || !c.sqlite3_stmt_readonly(stmt)) {
|
|
262
|
+
c.sqlite3_finalize(stmt);
|
|
263
|
+
throw new Error('the read-only database requires one read-only statement');
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
stmt,
|
|
267
|
+
count: c.sqlite3_bind_parameter_count(stmt)
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
let bind = (stmt, i, value)=>{
|
|
271
|
+
if (value == null) return c.sqlite3_bind_null(stmt, i);
|
|
272
|
+
if (typeof value == 'boolean' || typeof value == 'bigint' || typeof value == 'number' && Number.isSafeInteger(value)) {
|
|
273
|
+
return c.sqlite3_bind_int64(stmt, i, BigInt(value));
|
|
274
|
+
}
|
|
275
|
+
if (typeof value == 'number') return c.sqlite3_bind_double(stmt, i, value);
|
|
276
|
+
if (typeof value == 'string') {
|
|
277
|
+
let bytes = encoder.encode(value);
|
|
278
|
+
return c.sqlite3_bind_text(stmt, i, bytes.length ? bytes : empty, bytes.length, transient);
|
|
279
|
+
}
|
|
280
|
+
return c.sqlite3_bind_blob(stmt, i, value.length ? value : empty, value.length, transient);
|
|
281
|
+
};
|
|
282
|
+
let column = (stmt, i)=>{
|
|
283
|
+
let type = c.sqlite3_column_type(stmt, i);
|
|
284
|
+
switch(type){
|
|
285
|
+
case 1:
|
|
286
|
+
{
|
|
287
|
+
let value = c.sqlite3_column_int64(stmt, i), number = Number(value);
|
|
288
|
+
return Number.isSafeInteger(number) ? number : BigInt(value);
|
|
289
|
+
}
|
|
290
|
+
case 2:
|
|
291
|
+
return c.sqlite3_column_double(stmt, i);
|
|
292
|
+
case 3:
|
|
293
|
+
case 4:
|
|
294
|
+
{
|
|
295
|
+
let string = type == 3;
|
|
296
|
+
let p = string ? c.sqlite3_column_text(stmt, i) : c.sqlite3_column_blob(stmt, i);
|
|
297
|
+
let n = c.sqlite3_column_bytes(stmt, i);
|
|
298
|
+
if (!n || !p) return string ? '' : new Uint8Array();
|
|
299
|
+
let bytes = new Uint8Array(new Deno.UnsafePointerView(p).getArrayBuffer(n));
|
|
300
|
+
// Decoding consumes the current row synchronously; blobs need a
|
|
301
|
+
// copy that survives the next step or the connection closing.
|
|
302
|
+
return string ? decoder.decode(bytes) : bytes.slice();
|
|
303
|
+
}
|
|
304
|
+
default:
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
let run = (sql, params)=>{
|
|
309
|
+
let held = cache.get(sql);
|
|
310
|
+
if (held) cache.delete(sql);
|
|
311
|
+
else {
|
|
312
|
+
held = prepare(sql);
|
|
313
|
+
if (cache.size >= 256) {
|
|
314
|
+
let oldest = cache.keys().next().value;
|
|
315
|
+
c.sqlite3_finalize(cache.get(oldest).stmt);
|
|
316
|
+
cache.delete(oldest);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
cache.set(sql, held);
|
|
320
|
+
let { stmt, count } = held;
|
|
321
|
+
try {
|
|
322
|
+
if (params.length != count) {
|
|
323
|
+
throw new Error('parameters must match the statement');
|
|
324
|
+
}
|
|
325
|
+
params.forEach((value, i)=>check(bind(stmt, i + 1, value)));
|
|
326
|
+
let rows = [], names, code;
|
|
327
|
+
while((code = c.sqlite3_step(stmt)) == 100){
|
|
328
|
+
if (!names) {
|
|
329
|
+
// The first step may have recompiled the kept statement. Its
|
|
330
|
+
// column names stay valid until SQLite does so again.
|
|
331
|
+
let changed = c.sqlite3_stmt_status(stmt, 5, 1) // REPREPARE
|
|
332
|
+
;
|
|
333
|
+
if (!held.names || changed) {
|
|
334
|
+
held.names = Array.from({
|
|
335
|
+
length: c.sqlite3_column_count(stmt)
|
|
336
|
+
}, (_, i)=>text(c.sqlite3_column_name(stmt, i)));
|
|
337
|
+
}
|
|
338
|
+
names = held.names;
|
|
339
|
+
}
|
|
340
|
+
let row = Object.fromEntries(names.map((name, i)=>[
|
|
341
|
+
name,
|
|
342
|
+
column(stmt, i)
|
|
343
|
+
]));
|
|
344
|
+
meter(row);
|
|
345
|
+
rows.push(row);
|
|
346
|
+
}
|
|
347
|
+
if (code != 101) throw error() // SQLITE_DONE
|
|
348
|
+
;
|
|
349
|
+
check(c.sqlite3_reset(stmt));
|
|
350
|
+
check(c.sqlite3_clear_bindings(stmt));
|
|
351
|
+
return rows;
|
|
352
|
+
} catch (error) {
|
|
353
|
+
cache.delete(sql);
|
|
354
|
+
c.sqlite3_finalize(stmt);
|
|
355
|
+
throw error;
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
return Object.assign(driver(run, {
|
|
359
|
+
file: path != ':memory:' && path != '',
|
|
360
|
+
before: checkOpen
|
|
361
|
+
}), {
|
|
362
|
+
...c.sqlite3_load_extension && {
|
|
363
|
+
extension: (file)=>{
|
|
364
|
+
checkOpen();
|
|
365
|
+
// Enable only the C loading API, never SQL's load_extension().
|
|
366
|
+
check(c.sqlite3_db_config(db, 1005, 1, null)); // ENABLE_LOAD_EXTENSION
|
|
367
|
+
try {
|
|
368
|
+
check(c.sqlite3_load_extension(db, cstring(file), null, null));
|
|
369
|
+
} finally{
|
|
370
|
+
check(c.sqlite3_db_config(db, 1005, 0, null));
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
close
|
|
375
|
+
});
|
|
376
|
+
} catch (error) {
|
|
377
|
+
close();
|
|
378
|
+
throw error;
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
//# sourceMappingURL=read-db.js.map
|