@livestore/wa-sqlite 1.0.1-dev.0
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 +21 -0
- package/README.md +78 -0
- package/dist/wa-sqlite-async.mjs +16 -0
- package/dist/wa-sqlite-async.wasm +0 -0
- package/dist/wa-sqlite-jspi.mjs +16 -0
- package/dist/wa-sqlite-jspi.wasm +0 -0
- package/dist/wa-sqlite.mjs +16 -0
- package/dist/wa-sqlite.wasm +0 -0
- package/package.json +45 -0
- package/src/FacadeVFS.js +508 -0
- package/src/VFS.js +222 -0
- package/src/WebLocksMixin.js +412 -0
- package/src/examples/AccessHandlePoolVFS.js +458 -0
- package/src/examples/IDBBatchAtomicVFS.js +820 -0
- package/src/examples/IDBMirrorVFS.js +875 -0
- package/src/examples/MemoryAsyncVFS.js +100 -0
- package/src/examples/MemoryVFS.js +176 -0
- package/src/examples/OPFSAdaptiveVFS.js +437 -0
- package/src/examples/OPFSAnyContextVFS.js +300 -0
- package/src/examples/OPFSCoopSyncVFS.js +590 -0
- package/src/examples/OPFSPermutedVFS.js +1214 -0
- package/src/examples/README.md +89 -0
- package/src/examples/tag.js +82 -0
- package/src/sqlite-api.js +914 -0
- package/src/sqlite-constants.js +275 -0
- package/src/types/globals.d.ts +60 -0
- package/src/types/index.d.ts +1302 -0
- package/src/types/tsconfig.json +6 -0
- package/test/AccessHandlePoolVFS.test.js +27 -0
- package/test/IDBBatchAtomicVFS.test.js +97 -0
- package/test/IDBMirrorVFS.test.js +27 -0
- package/test/MemoryAsyncVFS.test.js +27 -0
- package/test/MemoryVFS.test.js +27 -0
- package/test/OPFSAdaptiveVFS.test.js +27 -0
- package/test/OPFSAnyContextVFS.test.js +27 -0
- package/test/OPFSCoopSyncVFS.test.js +27 -0
- package/test/OPFSPermutedVFS.test.js +27 -0
- package/test/TestContext.js +96 -0
- package/test/WebLocksMixin.test.js +521 -0
- package/test/api.test.js +49 -0
- package/test/api_exec.js +89 -0
- package/test/api_misc.js +63 -0
- package/test/api_statements.js +426 -0
- package/test/callbacks.test.js +373 -0
- package/test/sql.test.js +64 -0
- package/test/sql_0001.js +49 -0
- package/test/sql_0002.js +52 -0
- package/test/sql_0003.js +83 -0
- package/test/sql_0004.js +81 -0
- package/test/sql_0005.js +76 -0
- package/test/test-worker.js +204 -0
- package/test/vfs_xAccess.js +2 -0
- package/test/vfs_xClose.js +52 -0
- package/test/vfs_xOpen.js +91 -0
- package/test/vfs_xRead.js +38 -0
- package/test/vfs_xWrite.js +36 -0
|
@@ -0,0 +1,1302 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a WebAssembly build of SQLite with experimental support for
|
|
3
|
+
* writing SQLite virtual file systems and modules (for virtual tables)
|
|
4
|
+
* in Javascript. Also see the
|
|
5
|
+
* [GitHub repository](https://github.com/rhashimoto/wa-sqlite) and the
|
|
6
|
+
* [online demo](https://rhashimoto.github.io/wa-sqlite/demo/).
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Javascript types that SQLite can use
|
|
12
|
+
*
|
|
13
|
+
* C integer and floating-point types both map to/from Javascript `number`.
|
|
14
|
+
* Blob data can be provided to SQLite as `Uint8Array` or `number[]` (with
|
|
15
|
+
* each element converted to a byte); SQLite always returns blob data as
|
|
16
|
+
* `Uint8Array`
|
|
17
|
+
*/
|
|
18
|
+
type SQLiteCompatibleType = number|string|Uint8Array|Array<number>|bigint|null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* SQLite Virtual File System object
|
|
22
|
+
*
|
|
23
|
+
* Objects with this interface can be passed to {@link SQLiteAPI.vfs_register}
|
|
24
|
+
* to define a new filesystem.
|
|
25
|
+
*
|
|
26
|
+
* There are examples of a synchronous
|
|
27
|
+
* [MemoryVFS.js](https://github.com/rhashimoto/wa-sqlite/blob/master/src/examples/MemoryVFS.js),
|
|
28
|
+
* and asynchronous
|
|
29
|
+
* [MemoryAsyncVFS.js](https://github.com/rhashimoto/wa-sqlite/blob/master/src/examples/MemoryAsyncVFS.js)
|
|
30
|
+
* and
|
|
31
|
+
* [IndexedDbVFS.js](https://github.com/rhashimoto/wa-sqlite/blob/master/src/examples/IndexedDbVFS.js).
|
|
32
|
+
*
|
|
33
|
+
* @see https://sqlite.org/vfs.html
|
|
34
|
+
* @see https://sqlite.org/c3ref/io_methods.html
|
|
35
|
+
*/
|
|
36
|
+
declare interface SQLiteVFS {
|
|
37
|
+
/** Maximum length of a file path in UTF-8 bytes (default 64) */
|
|
38
|
+
mxPathName?: number;
|
|
39
|
+
|
|
40
|
+
close(): void|Promise<void>;
|
|
41
|
+
isReady(): boolean|Promise<boolean>;
|
|
42
|
+
|
|
43
|
+
/** @see https://sqlite.org/c3ref/io_methods.html */
|
|
44
|
+
xClose(fileId: number): number|Promise<number>;
|
|
45
|
+
|
|
46
|
+
/** @see https://sqlite.org/c3ref/io_methods.html */
|
|
47
|
+
xRead(
|
|
48
|
+
fileId: number,
|
|
49
|
+
pData: number,
|
|
50
|
+
iAmt: number,
|
|
51
|
+
iOffsetLo: number,
|
|
52
|
+
iOffsetHi: number
|
|
53
|
+
): number|Promise<number>;
|
|
54
|
+
|
|
55
|
+
/** @see https://sqlite.org/c3ref/io_methods.html */
|
|
56
|
+
xWrite(
|
|
57
|
+
fileId: number,
|
|
58
|
+
pData: number,
|
|
59
|
+
iAmt: number,
|
|
60
|
+
iOffsetLo: number,
|
|
61
|
+
iOffsetHi: number
|
|
62
|
+
): number|Promise<number>;
|
|
63
|
+
|
|
64
|
+
/** @see https://sqlite.org/c3ref/io_methods.html */
|
|
65
|
+
xTruncate(fileId: number, iSizeLo: number, iSizeHi): number|Promise<number>;
|
|
66
|
+
|
|
67
|
+
/** @see https://sqlite.org/c3ref/io_methods.html */
|
|
68
|
+
xSync(fileId: number, flags: number): number|Promise<number>;
|
|
69
|
+
|
|
70
|
+
/** @see https://sqlite.org/c3ref/io_methods.html */
|
|
71
|
+
xFileSize(
|
|
72
|
+
fileId: number,
|
|
73
|
+
pSize64: number
|
|
74
|
+
): number|Promise<number>;
|
|
75
|
+
|
|
76
|
+
/** @see https://sqlite.org/c3ref/io_methods.html */
|
|
77
|
+
xLock(fileId: number, flags: number): number|Promise<number>;
|
|
78
|
+
|
|
79
|
+
/** @see https://sqlite.org/c3ref/io_methods.html */
|
|
80
|
+
xUnlock(fileId: number, flags: number): number|Promise<number>;
|
|
81
|
+
|
|
82
|
+
/** @see https://sqlite.org/c3ref/io_methods.html */
|
|
83
|
+
xCheckReservedLock(
|
|
84
|
+
fileId: number,
|
|
85
|
+
pResOut: number
|
|
86
|
+
): number|Promise<number>;
|
|
87
|
+
|
|
88
|
+
/** @see https://sqlite.org/c3ref/io_methods.html */
|
|
89
|
+
xFileControl(
|
|
90
|
+
fileId: number,
|
|
91
|
+
flags: number,
|
|
92
|
+
pOut: number
|
|
93
|
+
): number|Promise<number>;
|
|
94
|
+
|
|
95
|
+
/** @see https://sqlite.org/c3ref/io_methods.html */
|
|
96
|
+
xDeviceCharacteristics(fileId: number): number|Promise<number>;
|
|
97
|
+
|
|
98
|
+
/** @see https://sqlite.org/c3ref/vfs.html */
|
|
99
|
+
xOpen(
|
|
100
|
+
pVfs: number,
|
|
101
|
+
zName: number,
|
|
102
|
+
pFile: number,
|
|
103
|
+
flags: number,
|
|
104
|
+
pOutFlags: number
|
|
105
|
+
): number|Promise<number>;
|
|
106
|
+
|
|
107
|
+
/** @see https://sqlite.org/c3ref/vfs.html */
|
|
108
|
+
xDelete(pVfs: number, zName: number, syncDir: number): number|Promise<number>;
|
|
109
|
+
|
|
110
|
+
/** @see https://sqlite.org/c3ref/vfs.html */
|
|
111
|
+
xAccess(
|
|
112
|
+
pVfs: number,
|
|
113
|
+
zName: number,
|
|
114
|
+
flags: number,
|
|
115
|
+
pResOut: number
|
|
116
|
+
): number|Promise<number>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Options object argument for {@link SQLiteAPI.statements}
|
|
121
|
+
*/
|
|
122
|
+
declare interface SQLitePrepareOptions {
|
|
123
|
+
/**
|
|
124
|
+
* Statement handles prepared and yielded by {@link SQLiteAPI.statements}
|
|
125
|
+
* are normally valid only within the scope of an iteration.
|
|
126
|
+
* Set `unscoped` to `true` to give iterated statements an arbitrary
|
|
127
|
+
* lifetime.
|
|
128
|
+
*/
|
|
129
|
+
unscoped?: boolean;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* SQLITE_PREPARE_* flags
|
|
133
|
+
* @see https://www.sqlite.org/c3ref/c_prepare_normalize.html#sqlitepreparepersistent
|
|
134
|
+
*/
|
|
135
|
+
flags?: number;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Javascript wrappers for the SQLite C API (plus a few convenience functions)
|
|
140
|
+
*
|
|
141
|
+
* Function signatures have been slightly modified to be more
|
|
142
|
+
* Javascript-friendly. For the C functions that return an error code,
|
|
143
|
+
* the corresponding Javascript wrapper will throw an exception with a
|
|
144
|
+
* `code` property on an error.
|
|
145
|
+
*
|
|
146
|
+
* Note that a few functions return a Promise in order to accomodate
|
|
147
|
+
* either a synchronous or asynchronous SQLite build, generally those
|
|
148
|
+
* involved with opening/closing a database or executing a statement.
|
|
149
|
+
*
|
|
150
|
+
* To create an instance of the API, follow these steps:
|
|
151
|
+
*
|
|
152
|
+
* ```javascript
|
|
153
|
+
* // Import an ES6 module factory function from one of the
|
|
154
|
+
* // package builds, either 'wa-sqlite.mjs' (synchronous) or
|
|
155
|
+
* // 'wa-sqlite-async.mjs' (asynchronous). You should only
|
|
156
|
+
* // use the asynchronous build if you plan to use an
|
|
157
|
+
* // asynchronous VFS or module.
|
|
158
|
+
* import SQLiteESMFactory from 'wa-sqlite/dist/wa-sqlite.mjs';
|
|
159
|
+
*
|
|
160
|
+
* // Import the Javascript API wrappers.
|
|
161
|
+
* import * as SQLite from 'wa-sqlite';
|
|
162
|
+
*
|
|
163
|
+
* // Use an async function to simplify Promise handling.
|
|
164
|
+
* (async function() {
|
|
165
|
+
* // Invoke the ES6 module factory to create the SQLite
|
|
166
|
+
* // Emscripten module. This will fetch and compile the
|
|
167
|
+
* // .wasm file.
|
|
168
|
+
* const module = await SQLiteESMFactory();
|
|
169
|
+
*
|
|
170
|
+
* // Use the module to build the API instance.
|
|
171
|
+
* const sqlite3 = SQLite.Factory(module);
|
|
172
|
+
*
|
|
173
|
+
* // Use the API to open and access a database.
|
|
174
|
+
* const db = await sqlite3.open_v2('myDB');
|
|
175
|
+
* ...
|
|
176
|
+
* })();
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* @see https://sqlite.org/c3ref/funclist.html
|
|
180
|
+
*/
|
|
181
|
+
declare interface SQLiteAPI {
|
|
182
|
+
/**
|
|
183
|
+
* Bind a collection of values to a statement
|
|
184
|
+
*
|
|
185
|
+
* This convenience function binds values from either an array or object
|
|
186
|
+
* to a prepared statement with placeholder parameters.
|
|
187
|
+
*
|
|
188
|
+
* Array example using numbered parameters (numbering is implicit in
|
|
189
|
+
* this example):
|
|
190
|
+
* ```
|
|
191
|
+
* const sql = 'INSERT INTO tbl VALUES (?, ?, ?)';
|
|
192
|
+
* for await (const stmt of sqlite3.statements(db, sql) {
|
|
193
|
+
* sqlite3.bind_collection(stmt, [42, 'hello', null]);
|
|
194
|
+
* ...
|
|
195
|
+
* }
|
|
196
|
+
* ```
|
|
197
|
+
*
|
|
198
|
+
* Object example using named parameters (':', '@', or '$' prefixes
|
|
199
|
+
* are allowed):
|
|
200
|
+
* ```
|
|
201
|
+
* const sql = 'INSERT INTO tbl VALUES (?, ?, ?)';
|
|
202
|
+
* for await (const stmt of sqlite3.statements(db, sql) {
|
|
203
|
+
* sqlite3.bind_collection(stmt, {
|
|
204
|
+
* '@foo': 42,
|
|
205
|
+
* '@bar': 'hello',
|
|
206
|
+
* '@baz': null,
|
|
207
|
+
* });
|
|
208
|
+
* ...
|
|
209
|
+
* }
|
|
210
|
+
* ```
|
|
211
|
+
*
|
|
212
|
+
* Note that SQLite bindings are indexed beginning with 1, but when
|
|
213
|
+
* binding values from an array `a` the values begin with `a[0]`.
|
|
214
|
+
* @param stmt prepared statement pointer
|
|
215
|
+
* @param bindings
|
|
216
|
+
* @returns `SQLITE_OK` (throws exception on error)
|
|
217
|
+
*/
|
|
218
|
+
bind_collection(
|
|
219
|
+
stmt: number,
|
|
220
|
+
bindings: {[index: string]: SQLiteCompatibleType|null}|Array<SQLiteCompatibleType|null>
|
|
221
|
+
): number;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Bind value to prepared statement
|
|
225
|
+
*
|
|
226
|
+
* This convenience function calls the appropriate `bind_*` function
|
|
227
|
+
* based on the type of `value`. Note that binding indices begin with 1.
|
|
228
|
+
* @param stmt prepared statement pointer
|
|
229
|
+
* @param i binding index
|
|
230
|
+
* @param value
|
|
231
|
+
* @returns `SQLITE_OK` (throws exception on error)
|
|
232
|
+
*/
|
|
233
|
+
bind(stmt: number, i: number, value: SQLiteCompatibleType|null): number;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Bind blob to prepared statement parameter
|
|
237
|
+
*
|
|
238
|
+
* Note that binding indices begin with 1.
|
|
239
|
+
* @see https://www.sqlite.org/c3ref/bind_blob.html
|
|
240
|
+
* @param stmt prepared statement pointer
|
|
241
|
+
* @param i binding index
|
|
242
|
+
* @param value
|
|
243
|
+
* @returns `SQLITE_OK` (throws exception on error)
|
|
244
|
+
*/
|
|
245
|
+
bind_blob(stmt: number, i: number, value: Uint8Array|Array<number>): number;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Bind number to prepared statement parameter
|
|
249
|
+
*
|
|
250
|
+
* Note that binding indices begin with 1.
|
|
251
|
+
* @see https://www.sqlite.org/c3ref/bind_blob.html
|
|
252
|
+
* @param stmt prepared statement pointer
|
|
253
|
+
* @param i binding index
|
|
254
|
+
* @param value
|
|
255
|
+
* @returns `SQLITE_OK` (throws exception on error)
|
|
256
|
+
*/
|
|
257
|
+
bind_double(stmt: number, i: number, value: number): number;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Bind number to prepared statement parameter
|
|
261
|
+
*
|
|
262
|
+
* Note that binding indices begin with 1.
|
|
263
|
+
* @see https://www.sqlite.org/c3ref/bind_blob.html
|
|
264
|
+
* @param stmt prepared statement pointer
|
|
265
|
+
* @param i binding index
|
|
266
|
+
* @param value
|
|
267
|
+
* @returns `SQLITE_OK` (throws exception on error)
|
|
268
|
+
*/
|
|
269
|
+
bind_int(stmt: number, i: number, value: number): number;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Bind number to prepared statement parameter
|
|
273
|
+
*
|
|
274
|
+
* Note that binding indices begin with 1.
|
|
275
|
+
* @see https://www.sqlite.org/c3ref/bind_blob.html
|
|
276
|
+
* @param stmt prepared statement pointer
|
|
277
|
+
* @param i binding index
|
|
278
|
+
* @param value
|
|
279
|
+
* @returns `SQLITE_OK` (throws exception on error)
|
|
280
|
+
*/
|
|
281
|
+
bind_int64(stmt: number, i: number, value: bigint): number;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Bind null to prepared statement
|
|
285
|
+
*
|
|
286
|
+
* Note that binding indices begin with 1.
|
|
287
|
+
* @see https://www.sqlite.org/c3ref/bind_blob.html
|
|
288
|
+
* @param stmt prepared statement pointer
|
|
289
|
+
* @param i binding index
|
|
290
|
+
* @returns `SQLITE_OK` (throws exception on error)
|
|
291
|
+
*/
|
|
292
|
+
bind_null(stmt: number, i: number): number;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Get number of bound parameters
|
|
296
|
+
* @see https://www.sqlite.org/c3ref/bind_parameter_count.html
|
|
297
|
+
* @param stmt prepared statement pointer
|
|
298
|
+
* @returns number of statement binding locations
|
|
299
|
+
*/
|
|
300
|
+
bind_parameter_count(stmt: number): number;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Get name of bound parameter
|
|
304
|
+
*
|
|
305
|
+
* Note that binding indices begin with 1.
|
|
306
|
+
* @see https://www.sqlite.org/c3ref/bind_parameter_name.html
|
|
307
|
+
* @param stmt prepared statement pointer
|
|
308
|
+
* @param i binding index
|
|
309
|
+
* @returns binding name
|
|
310
|
+
*/
|
|
311
|
+
bind_parameter_name(stmt: number, i: number): string;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Bind string to prepared statement
|
|
315
|
+
*
|
|
316
|
+
* Note that binding indices begin with 1.
|
|
317
|
+
* @see https://www.sqlite.org/c3ref/bind_blob.html
|
|
318
|
+
* @param stmt prepared statement pointer
|
|
319
|
+
* @param i binding index
|
|
320
|
+
* @param value
|
|
321
|
+
* @returns `SQLITE_OK` (throws exception on error)
|
|
322
|
+
*/
|
|
323
|
+
bind_text(stmt: number, i: number, value: string): number;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Get count of rows modified by last insert/update
|
|
327
|
+
* @see https://www.sqlite.org/c3ref/changes.html
|
|
328
|
+
* @param db database pointer
|
|
329
|
+
* @returns number of rows modified
|
|
330
|
+
*/
|
|
331
|
+
changes(db): number;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Reset all bindings on a prepared statement.
|
|
335
|
+
* @see https://www.sqlite.org/c3ref/clear_bindings.html
|
|
336
|
+
* @param stmt prepared statement pointer
|
|
337
|
+
* @returns `SQLITE_OK` (throws exception on error)
|
|
338
|
+
*/
|
|
339
|
+
clear_bindings(stmt: number): number;
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Close database connection
|
|
343
|
+
* @see https://www.sqlite.org/c3ref/close.html
|
|
344
|
+
* @param db database pointer
|
|
345
|
+
* @returns `SQLITE_OK` (throws exception on error)
|
|
346
|
+
*/
|
|
347
|
+
close(db): Promise<number>;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Call the appropriate `column_*` function based on the column type
|
|
351
|
+
*
|
|
352
|
+
* The type is determined by calling {@link column_type}, which may
|
|
353
|
+
* not match the type declared in `CREATE TABLE`. Note that if the column
|
|
354
|
+
* value is a blob then as with `column_blob` the result may be invalid
|
|
355
|
+
* after the next SQLite call; copy if it needs to be retained.
|
|
356
|
+
*
|
|
357
|
+
* Integer values are returned as Number if within the min/max safe
|
|
358
|
+
* integer bounds, otherwise they are returned as BigInt.
|
|
359
|
+
* @param stmt prepared statement pointer
|
|
360
|
+
* @param i column index
|
|
361
|
+
* @returns column value
|
|
362
|
+
*/
|
|
363
|
+
column(stmt: number, i: number): SQLiteCompatibleType;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Extract a column value from a row after a prepared statment {@link step}
|
|
367
|
+
*
|
|
368
|
+
* The contents of the returned buffer may be invalid after the
|
|
369
|
+
* next SQLite call. Make a copy of the data (e.g. with `.slice()`)
|
|
370
|
+
* if longer retention is required.
|
|
371
|
+
* @see https://www.sqlite.org/c3ref/column_blob.html
|
|
372
|
+
* @param stmt prepared statement pointer
|
|
373
|
+
* @param i column index
|
|
374
|
+
* @returns column value
|
|
375
|
+
*/
|
|
376
|
+
column_blob(stmt: number, i: number): Uint8Array;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Get storage size for column text or blob
|
|
380
|
+
* @see https://www.sqlite.org/c3ref/column_blob.html
|
|
381
|
+
* @param stmt prepared statement pointer
|
|
382
|
+
* @param i column index
|
|
383
|
+
* @returns number of bytes in column text or blob
|
|
384
|
+
*/
|
|
385
|
+
column_bytes(stmt: number, i: number): number;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Get number of columns for a prepared statement
|
|
389
|
+
* @see https://www.sqlite.org/c3ref/column_blob.html
|
|
390
|
+
* @param stmt prepared statement pointer
|
|
391
|
+
* @returns number of columns
|
|
392
|
+
*/
|
|
393
|
+
column_count(stmt: number): number;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Extract a column value from a row after a prepared statment {@link step}
|
|
397
|
+
* @see https://www.sqlite.org/c3ref/column_blob.html
|
|
398
|
+
* @param stmt prepared statement pointer
|
|
399
|
+
* @param i column index
|
|
400
|
+
* @returns column value
|
|
401
|
+
*/
|
|
402
|
+
column_double(stmt: number, i: number): number;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Extract a column value from a row after a prepared statment {@link step}
|
|
406
|
+
* @see https://www.sqlite.org/c3ref/column_blob.html
|
|
407
|
+
* @param stmt prepared statement pointer
|
|
408
|
+
* @param i column index
|
|
409
|
+
* @returns column value
|
|
410
|
+
*/
|
|
411
|
+
column_int(stmt: number, i: number): number;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Extract a column value from a row after a prepared statment {@link step}
|
|
415
|
+
* @see https://www.sqlite.org/c3ref/column_blob.html
|
|
416
|
+
* @param stmt prepared statement pointer
|
|
417
|
+
* @param i column index
|
|
418
|
+
* @returns column value
|
|
419
|
+
*/
|
|
420
|
+
column_int64(stmt: number, i: number): bigint;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Get a column name for a prepared statement
|
|
424
|
+
* @see https://www.sqlite.org/c3ref/column_blob.html
|
|
425
|
+
* @param stmt prepared statement pointer
|
|
426
|
+
* @param i column index
|
|
427
|
+
* @returns column name
|
|
428
|
+
*/
|
|
429
|
+
column_name(stmt: number, i: number): string;
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Get names for all columns of a prepared statement
|
|
433
|
+
*
|
|
434
|
+
* This is a convenience function that calls {@link column_count} and
|
|
435
|
+
* {@link column_name}.
|
|
436
|
+
* @param stmt
|
|
437
|
+
* @returns array of column names
|
|
438
|
+
*/
|
|
439
|
+
column_names(stmt: number): Array<string>;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Extract a column value from a row after a prepared statment {@link step}
|
|
443
|
+
* @see https://www.sqlite.org/c3ref/column_blob.html
|
|
444
|
+
* @param stmt prepared statement pointer
|
|
445
|
+
* @param i column index
|
|
446
|
+
* @returns column value
|
|
447
|
+
*/
|
|
448
|
+
column_text(stmt: number, i: number): string;
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Get column type for a prepared statement
|
|
452
|
+
*
|
|
453
|
+
* Note that this type may not match the type declared in `CREATE TABLE`.
|
|
454
|
+
* @see https://www.sqlite.org/c3ref/column_blob.html
|
|
455
|
+
* @param stmt prepared statement pointer
|
|
456
|
+
* @param i column index
|
|
457
|
+
* @returns enumeration value for type
|
|
458
|
+
*/
|
|
459
|
+
column_type(stmt: number, i: number): number;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Create or redefine SQL functions
|
|
463
|
+
*
|
|
464
|
+
* The application data passed is ignored. Use closures instead.
|
|
465
|
+
*
|
|
466
|
+
* If any callback function returns a Promise, that function must
|
|
467
|
+
* be declared `async`, i.e. it must allow use of `await`.
|
|
468
|
+
* @see https://sqlite.org/c3ref/create_function.html
|
|
469
|
+
* @param db database pointer
|
|
470
|
+
* @param zFunctionName
|
|
471
|
+
* @param nArg number of function arguments
|
|
472
|
+
* @param eTextRep text encoding (and other flags)
|
|
473
|
+
* @param pApp application data (ignored)
|
|
474
|
+
* @param xFunc
|
|
475
|
+
* @param xStep
|
|
476
|
+
* @param xFinal
|
|
477
|
+
* @returns `SQLITE_OK` (throws exception on error)
|
|
478
|
+
*/
|
|
479
|
+
create_function(
|
|
480
|
+
db: number,
|
|
481
|
+
zFunctionName: string,
|
|
482
|
+
nArg: number,
|
|
483
|
+
eTextRep: number,
|
|
484
|
+
pApp: number,
|
|
485
|
+
xFunc?: (context: number, values: Uint32Array) => void|Promise<void>,
|
|
486
|
+
xStep?: (context: number, values: Uint32Array) => void|Promise<void>,
|
|
487
|
+
xFinal?: (context: number) => void|Promise<void>): number;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Get number of columns in current row of a prepared statement
|
|
491
|
+
* @see https://www.sqlite.org/c3ref/data_count.html
|
|
492
|
+
* @param stmt prepared statement pointer
|
|
493
|
+
* @returns number of columns
|
|
494
|
+
*/
|
|
495
|
+
data_count(stmt: number): number;
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* One-step query execution interface
|
|
499
|
+
*
|
|
500
|
+
* The implementation of this function uses {@link row}, which makes a
|
|
501
|
+
* copy of blobs and returns BigInt for integers outside the safe integer
|
|
502
|
+
* bounds for Number.
|
|
503
|
+
* @see https://www.sqlite.org/c3ref/exec.html
|
|
504
|
+
* @param db database pointer
|
|
505
|
+
* @param zSQL queries
|
|
506
|
+
* @param callback called for each output row
|
|
507
|
+
* @returns Promise resolving to `SQLITE_OK` (rejects on error)
|
|
508
|
+
*/
|
|
509
|
+
exec(
|
|
510
|
+
db: number,
|
|
511
|
+
zSQL: string,
|
|
512
|
+
callback?: (row: Array<SQLiteCompatibleType|null>, columns: string[]) => void
|
|
513
|
+
// ): Promise<number>;
|
|
514
|
+
): number;
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Destroy a prepared statement object compiled by {@link statements}
|
|
518
|
+
* with the `unscoped` option set to `true`
|
|
519
|
+
*
|
|
520
|
+
* This function does *not* throw on error.
|
|
521
|
+
* @see https://www.sqlite.org/c3ref/finalize.html
|
|
522
|
+
* @param stmt prepared statement pointer
|
|
523
|
+
* @returns Promise resolving to `SQLITE_OK` or error status
|
|
524
|
+
*/
|
|
525
|
+
// finalize(stmt: number): Promise<number>;
|
|
526
|
+
finalize(stmt: number): number;
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Test for autocommit mode
|
|
530
|
+
* @see https://sqlite.org/c3ref/get_autocommit.html
|
|
531
|
+
* @param db database pointer
|
|
532
|
+
* @returns Non-zero if autocommit mode is on, zero otherwise
|
|
533
|
+
*/
|
|
534
|
+
get_autocommit(db: number): number;
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Get SQLite library version
|
|
538
|
+
* @see https://www.sqlite.org/c3ref/libversion.html
|
|
539
|
+
* @returns version string, e.g. '3.35.5'
|
|
540
|
+
*/
|
|
541
|
+
libversion(): string;
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Get SQLite library version
|
|
545
|
+
* @see https://www.sqlite.org/c3ref/libversion.html
|
|
546
|
+
* @returns version number, e.g. 3035005
|
|
547
|
+
*/
|
|
548
|
+
libversion_number(): number
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Set a usage limit on a connection.
|
|
552
|
+
* @see https://www.sqlite.org/c3ref/limit.html
|
|
553
|
+
* @param db database pointer
|
|
554
|
+
* @param id limit category
|
|
555
|
+
* @param newVal
|
|
556
|
+
* @returns previous setting
|
|
557
|
+
*/
|
|
558
|
+
limit(
|
|
559
|
+
db: number,
|
|
560
|
+
id: number,
|
|
561
|
+
newVal: number): number;
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Opening a new database connection.
|
|
565
|
+
*
|
|
566
|
+
* Note that this function differs from the C API in that it
|
|
567
|
+
* returns the Promise-wrapped database pointer (instead of a
|
|
568
|
+
* result code).
|
|
569
|
+
* @see https://sqlite.org/c3ref/open.html
|
|
570
|
+
* @param zFilename
|
|
571
|
+
* @param iFlags `SQLite.SQLITE_OPEN_CREATE | SQLite.SQLITE_OPEN_READWRITE` (0x6) if omitted
|
|
572
|
+
* @param zVfs VFS name
|
|
573
|
+
* @returns Promise-wrapped database pointer.
|
|
574
|
+
*/
|
|
575
|
+
open_v2(
|
|
576
|
+
zFilename: string,
|
|
577
|
+
iFlags?: number,
|
|
578
|
+
zVfs?: string
|
|
579
|
+
): Promise<number>;
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Specify callback to be invoked between long-running queries
|
|
583
|
+
*
|
|
584
|
+
* The application data passed is ignored. Use closures instead.
|
|
585
|
+
*
|
|
586
|
+
* If any callback function returns a Promise, that function must
|
|
587
|
+
* be declared `async`, i.e. it must allow use of `await`.
|
|
588
|
+
* @param db database pointer
|
|
589
|
+
* @param nProgressOps target number of database operations between handler invocations
|
|
590
|
+
* @param handler
|
|
591
|
+
* @param userData
|
|
592
|
+
*/
|
|
593
|
+
progress_handler(db: number, nProgressOps: number, handler: (userData: any) => number|Promise<number>, userData);
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Reset a prepared statement object
|
|
597
|
+
* @see https://www.sqlite.org/c3ref/reset.html
|
|
598
|
+
* @param stmt prepared statement pointer
|
|
599
|
+
* @returns Promise-wrapped `SQLITE_OK` (rejects on error)
|
|
600
|
+
*/
|
|
601
|
+
reset(stmt: number): Promise<number>;
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Convenience function to call `result_*` based of the type of `value`
|
|
605
|
+
* @param context context pointer
|
|
606
|
+
* @param value
|
|
607
|
+
*/
|
|
608
|
+
result(context: number, value: (SQLiteCompatibleType|number[])|null): void;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Set the result of a function or vtable column
|
|
612
|
+
* @see https://sqlite.org/c3ref/result_blob.html
|
|
613
|
+
* @param context context pointer
|
|
614
|
+
* @param value
|
|
615
|
+
*/
|
|
616
|
+
result_blob(context: number, value: Uint8Array|number[]): void;
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Set the result of a function or vtable column
|
|
620
|
+
* @see https://sqlite.org/c3ref/result_blob.html
|
|
621
|
+
* @param context context pointer
|
|
622
|
+
* @param value
|
|
623
|
+
*/
|
|
624
|
+
result_double(context: number, value: number): void;
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Set the result of a function or vtable column
|
|
628
|
+
* @see https://sqlite.org/c3ref/result_blob.html
|
|
629
|
+
* @param context context pointer
|
|
630
|
+
* @param value
|
|
631
|
+
*/
|
|
632
|
+
result_int(context: number, value: number): void;
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Set the result of a function or vtable column
|
|
636
|
+
* @see https://sqlite.org/c3ref/result_blob.html
|
|
637
|
+
* @param context context pointer
|
|
638
|
+
* @param value
|
|
639
|
+
*/
|
|
640
|
+
result_int64(context: number, value: bigint): void;
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Set the result of a function or vtable column
|
|
644
|
+
* @see https://sqlite.org/c3ref/result_blob.html
|
|
645
|
+
* @param context context pointer
|
|
646
|
+
*/
|
|
647
|
+
result_null(context: number): void;
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Set the result of a function or vtable column
|
|
651
|
+
* @see https://sqlite.org/c3ref/result_blob.html
|
|
652
|
+
* @param context context pointer
|
|
653
|
+
* @param value
|
|
654
|
+
*/
|
|
655
|
+
result_text(context: number, value: string): void;
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Get all column data for a row from a prepared statement step
|
|
659
|
+
*
|
|
660
|
+
* This convenience function will return a copy of any blob, unlike
|
|
661
|
+
* {@link column_blob} which returns a value referencing volatile WASM
|
|
662
|
+
* memory with short validity. Like {@link column}, it will return a
|
|
663
|
+
* BigInt for integers outside the safe integer bounds for Number.
|
|
664
|
+
* @param stmt prepared statement pointer
|
|
665
|
+
* @returns row data
|
|
666
|
+
*/
|
|
667
|
+
row(stmt: number): Array<SQLiteCompatibleType|null>;
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Register a callback function that is invoked to authorize certain SQL statement actions.
|
|
671
|
+
* @see https://www.sqlite.org/c3ref/set_authorizer.html
|
|
672
|
+
* @param db database pointer
|
|
673
|
+
* @param authFunction
|
|
674
|
+
* @param userData
|
|
675
|
+
*/
|
|
676
|
+
set_authorizer(
|
|
677
|
+
db: number,
|
|
678
|
+
authFunction: (userData: any, iActionCode: number, param3: string|null, param4: string|null, param5: string|null, param6: string|null) => number|Promise<number>,
|
|
679
|
+
userData: any): number;
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Get statement SQL
|
|
683
|
+
* @see https://www.sqlite.org/c3ref/expanded_sql.html
|
|
684
|
+
* @param stmt prepared statement pointer
|
|
685
|
+
* @returns SQL
|
|
686
|
+
*/
|
|
687
|
+
sql(stmt: number): string;
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* SQL statement iterator
|
|
691
|
+
*
|
|
692
|
+
* This function manages statement compilation by creating an async
|
|
693
|
+
* iterator that yields a prepared statement handle on each iteration.
|
|
694
|
+
* It is typically used with a `for await` loop (in an async function),
|
|
695
|
+
* like this:
|
|
696
|
+
* ```javascript
|
|
697
|
+
* // Compile one statement on each iteration of this loop.
|
|
698
|
+
* for await (const stmt of sqlite3.statements(db, sql)) {
|
|
699
|
+
* // Bind parameters here if using SQLite placeholders.
|
|
700
|
+
*
|
|
701
|
+
* // Execute the statement with this loop.
|
|
702
|
+
* while (await sqlite3.step(stmt) === SQLite.SQLITE_ROW) {
|
|
703
|
+
* // Collect row data here.
|
|
704
|
+
* }
|
|
705
|
+
*
|
|
706
|
+
* // Change bindings, reset, and execute again if desired.
|
|
707
|
+
* }
|
|
708
|
+
* ```
|
|
709
|
+
*
|
|
710
|
+
* By default, the lifetime of a yielded prepared statement is managed
|
|
711
|
+
* automatically by the iterator, ending at the end of each iteration.
|
|
712
|
+
* {@link finalize} should *not* be called on a statement provided by
|
|
713
|
+
* the iterator unless the `unscoped` option is set to `true` (that
|
|
714
|
+
* option is provided for applications that wish to manage statement
|
|
715
|
+
* lifetimes manually).
|
|
716
|
+
*
|
|
717
|
+
* If using the iterator manually, i.e. by calling its `next`
|
|
718
|
+
* method, be sure to call the `return` method if iteration
|
|
719
|
+
* is abandoned before completion (`for await` and other implicit
|
|
720
|
+
* traversals provided by Javascript do this automatically)
|
|
721
|
+
* to ensure that all allocated resources are released.
|
|
722
|
+
* @see https://www.sqlite.org/c3ref/prepare.html
|
|
723
|
+
* @param db database pointer
|
|
724
|
+
* @param sql
|
|
725
|
+
* @param options
|
|
726
|
+
*/
|
|
727
|
+
// statements(db: number, sql: string, options?: SQLitePrepareOptions): AsyncIterable<number>;
|
|
728
|
+
statements(db: number, sql: string, options?: SQLitePrepareOptions): Iterable<number>;
|
|
729
|
+
|
|
730
|
+
/**
|
|
731
|
+
* Evaluate an SQL statement
|
|
732
|
+
* @see https://www.sqlite.org/c3ref/step.html
|
|
733
|
+
* @param stmt prepared statement pointer
|
|
734
|
+
* @returns Promise resolving to `SQLITE_ROW` or `SQLITE_DONE`
|
|
735
|
+
* (rejects on error)
|
|
736
|
+
*/
|
|
737
|
+
// step(stmt: number): Promise<number>;
|
|
738
|
+
step(stmt: number): number;
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* Extract a value from `sqlite3_value`
|
|
742
|
+
*
|
|
743
|
+
* This is a convenience function that calls the appropriate `value_*`
|
|
744
|
+
* function based on its type. Note that if the value is a blob then as
|
|
745
|
+
* with `value_blob` the result may be invalid after the next SQLite call.
|
|
746
|
+
*
|
|
747
|
+
* Integer values are returned as Number if within the min/max safe
|
|
748
|
+
* integer bounds, otherwise they are returned as BigInt.
|
|
749
|
+
* @param pValue `sqlite3_value` pointer
|
|
750
|
+
* @returns value
|
|
751
|
+
*/
|
|
752
|
+
value(pValue: number): SQLiteCompatibleType;
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* Extract a value from `sqlite3_value`
|
|
756
|
+
*
|
|
757
|
+
* The contents of the returned buffer may be invalid after the
|
|
758
|
+
* next SQLite call. Make a copy of the data (e.g. with `.slice()`)
|
|
759
|
+
* if longer retention is required.
|
|
760
|
+
* @see https://sqlite.org/c3ref/value_blob.html
|
|
761
|
+
* @param pValue `sqlite3_value` pointer
|
|
762
|
+
* @returns value
|
|
763
|
+
*/
|
|
764
|
+
value_blob(pValue: number): Uint8Array;
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* Get blob or text size for value
|
|
768
|
+
* @see https://sqlite.org/c3ref/value_blob.html
|
|
769
|
+
* @param pValue `sqlite3_value` pointer
|
|
770
|
+
* @returns size
|
|
771
|
+
*/
|
|
772
|
+
value_bytes(pValue: number): number;
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Extract a value from `sqlite3_value`
|
|
776
|
+
* @see https://sqlite.org/c3ref/value_blob.html
|
|
777
|
+
* @param pValue `sqlite3_value` pointer
|
|
778
|
+
* @returns value
|
|
779
|
+
*/
|
|
780
|
+
value_double(pValue: number): number;
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* Extract a value from `sqlite3_value`
|
|
784
|
+
* @see https://sqlite.org/c3ref/value_blob.html
|
|
785
|
+
* @param pValue `sqlite3_value` pointer
|
|
786
|
+
* @returns value
|
|
787
|
+
*/
|
|
788
|
+
value_int(pValue: number): number;
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* Extract a value from `sqlite3_value`
|
|
792
|
+
* @see https://sqlite.org/c3ref/value_blob.html
|
|
793
|
+
* @param pValue `sqlite3_value` pointer
|
|
794
|
+
* @returns value
|
|
795
|
+
*/
|
|
796
|
+
value_int64(pValue: number): bigint;
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* Extract a value from `sqlite3_value`
|
|
800
|
+
* @see https://sqlite.org/c3ref/value_blob.html
|
|
801
|
+
* @param pValue `sqlite3_value` pointer
|
|
802
|
+
* @returns value
|
|
803
|
+
*/
|
|
804
|
+
value_text(pValue: number): string;
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Get type of `sqlite3_value`
|
|
808
|
+
* @see https://sqlite.org/c3ref/value_blob.html
|
|
809
|
+
* @param pValue `sqlite3_value` pointer
|
|
810
|
+
* @returns enumeration value for type
|
|
811
|
+
*/
|
|
812
|
+
value_type(pValue: number): number;
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* Register a new Virtual File System.
|
|
816
|
+
*
|
|
817
|
+
* @see https://www.sqlite.org/c3ref/vfs_find.html
|
|
818
|
+
* @param vfs VFS object
|
|
819
|
+
* @param makeDefault
|
|
820
|
+
* @returns `SQLITE_OK` (throws exception on error)
|
|
821
|
+
*/
|
|
822
|
+
vfs_register(vfs: SQLiteVFS, makeDefault?: boolean): number;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/** @ignore */
|
|
826
|
+
declare module 'wa-sqlite/src/sqlite-constants.js' {
|
|
827
|
+
export const SQLITE_OK: 0;
|
|
828
|
+
export const SQLITE_ERROR: 1;
|
|
829
|
+
export const SQLITE_INTERNAL: 2;
|
|
830
|
+
export const SQLITE_PERM: 3;
|
|
831
|
+
export const SQLITE_ABORT: 4;
|
|
832
|
+
export const SQLITE_BUSY: 5;
|
|
833
|
+
export const SQLITE_LOCKED: 6;
|
|
834
|
+
export const SQLITE_NOMEM: 7;
|
|
835
|
+
export const SQLITE_READONLY: 8;
|
|
836
|
+
export const SQLITE_INTERRUPT: 9;
|
|
837
|
+
export const SQLITE_IOERR: 10;
|
|
838
|
+
export const SQLITE_CORRUPT: 11;
|
|
839
|
+
export const SQLITE_NOTFOUND: 12;
|
|
840
|
+
export const SQLITE_FULL: 13;
|
|
841
|
+
export const SQLITE_CANTOPEN: 14;
|
|
842
|
+
export const SQLITE_PROTOCOL: 15;
|
|
843
|
+
export const SQLITE_EMPTY: 16;
|
|
844
|
+
export const SQLITE_SCHEMA: 17;
|
|
845
|
+
export const SQLITE_TOOBIG: 18;
|
|
846
|
+
export const SQLITE_CONSTRAINT: 19;
|
|
847
|
+
export const SQLITE_MISMATCH: 20;
|
|
848
|
+
export const SQLITE_MISUSE: 21;
|
|
849
|
+
export const SQLITE_NOLFS: 22;
|
|
850
|
+
export const SQLITE_AUTH: 23;
|
|
851
|
+
export const SQLITE_FORMAT: 24;
|
|
852
|
+
export const SQLITE_RANGE: 25;
|
|
853
|
+
export const SQLITE_NOTADB: 26;
|
|
854
|
+
export const SQLITE_NOTICE: 27;
|
|
855
|
+
export const SQLITE_WARNING: 28;
|
|
856
|
+
export const SQLITE_ROW: 100;
|
|
857
|
+
export const SQLITE_DONE: 101;
|
|
858
|
+
export const SQLITE_IOERR_ACCESS: 3338;
|
|
859
|
+
export const SQLITE_IOERR_CHECKRESERVEDLOCK: 3594;
|
|
860
|
+
export const SQLITE_IOERR_CLOSE: 4106;
|
|
861
|
+
export const SQLITE_IOERR_DATA: 8202;
|
|
862
|
+
export const SQLITE_IOERR_DELETE: 2570;
|
|
863
|
+
export const SQLITE_IOERR_DELETE_NOENT: 5898;
|
|
864
|
+
export const SQLITE_IOERR_DIR_FSYNC: 1290;
|
|
865
|
+
export const SQLITE_IOERR_FSTAT: 1802;
|
|
866
|
+
export const SQLITE_IOERR_FSYNC: 1034;
|
|
867
|
+
export const SQLITE_IOERR_GETTEMPPATH: 6410;
|
|
868
|
+
export const SQLITE_IOERR_LOCK: 3850;
|
|
869
|
+
export const SQLITE_IOERR_NOMEM: 3082;
|
|
870
|
+
export const SQLITE_IOERR_READ: 266;
|
|
871
|
+
export const SQLITE_IOERR_RDLOCK: 2314;
|
|
872
|
+
export const SQLITE_IOERR_SEEK: 5642;
|
|
873
|
+
export const SQLITE_IOERR_SHORT_READ: 522;
|
|
874
|
+
export const SQLITE_IOERR_TRUNCATE: 1546;
|
|
875
|
+
export const SQLITE_IOERR_UNLOCK: 2058;
|
|
876
|
+
export const SQLITE_IOERR_VNODE: 6922;
|
|
877
|
+
export const SQLITE_IOERR_WRITE: 778;
|
|
878
|
+
export const SQLITE_IOERR_BEGIN_ATOMIC: 7434;
|
|
879
|
+
export const SQLITE_IOERR_COMMIT_ATOMIC: 7690;
|
|
880
|
+
export const SQLITE_IOERR_ROLLBACK_ATOMIC: 7946;
|
|
881
|
+
export const SQLITE_CONSTRAINT_CHECK: 275;
|
|
882
|
+
export const SQLITE_CONSTRAINT_COMMITHOOK: 531;
|
|
883
|
+
export const SQLITE_CONSTRAINT_FOREIGNKEY: 787;
|
|
884
|
+
export const SQLITE_CONSTRAINT_FUNCTION: 1043;
|
|
885
|
+
export const SQLITE_CONSTRAINT_NOTNULL: 1299;
|
|
886
|
+
export const SQLITE_CONSTRAINT_PINNED: 2835;
|
|
887
|
+
export const SQLITE_CONSTRAINT_PRIMARYKEY: 1555;
|
|
888
|
+
export const SQLITE_CONSTRAINT_ROWID: 2579;
|
|
889
|
+
export const SQLITE_CONSTRAINT_TRIGGER: 1811;
|
|
890
|
+
export const SQLITE_CONSTRAINT_UNIQUE: 2067;
|
|
891
|
+
export const SQLITE_CONSTRAINT_VTAB: 2323;
|
|
892
|
+
export const SQLITE_OPEN_READONLY: 1;
|
|
893
|
+
export const SQLITE_OPEN_READWRITE: 2;
|
|
894
|
+
export const SQLITE_OPEN_CREATE: 4;
|
|
895
|
+
export const SQLITE_OPEN_DELETEONCLOSE: 8;
|
|
896
|
+
export const SQLITE_OPEN_EXCLUSIVE: 16;
|
|
897
|
+
export const SQLITE_OPEN_AUTOPROXY: 32;
|
|
898
|
+
export const SQLITE_OPEN_URI: 64;
|
|
899
|
+
export const SQLITE_OPEN_MEMORY: 128;
|
|
900
|
+
export const SQLITE_OPEN_MAIN_DB: 256;
|
|
901
|
+
export const SQLITE_OPEN_TEMP_DB: 512;
|
|
902
|
+
export const SQLITE_OPEN_TRANSIENT_DB: 1024;
|
|
903
|
+
export const SQLITE_OPEN_MAIN_JOURNAL: 2048;
|
|
904
|
+
export const SQLITE_OPEN_TEMP_JOURNAL: 4096;
|
|
905
|
+
export const SQLITE_OPEN_SUBJOURNAL: 8192;
|
|
906
|
+
export const SQLITE_OPEN_SUPER_JOURNAL: 16384;
|
|
907
|
+
export const SQLITE_OPEN_NOMUTEX: 32768;
|
|
908
|
+
export const SQLITE_OPEN_FULLMUTEX: 65536;
|
|
909
|
+
export const SQLITE_OPEN_SHAREDCACHE: 131072;
|
|
910
|
+
export const SQLITE_OPEN_PRIVATECACHE: 262144;
|
|
911
|
+
export const SQLITE_OPEN_WAL: 524288;
|
|
912
|
+
export const SQLITE_OPEN_NOFOLLOW: 16777216;
|
|
913
|
+
export const SQLITE_LOCK_NONE: 0;
|
|
914
|
+
export const SQLITE_LOCK_SHARED: 1;
|
|
915
|
+
export const SQLITE_LOCK_RESERVED: 2;
|
|
916
|
+
export const SQLITE_LOCK_PENDING: 3;
|
|
917
|
+
export const SQLITE_LOCK_EXCLUSIVE: 4;
|
|
918
|
+
export const SQLITE_IOCAP_ATOMIC: 1;
|
|
919
|
+
export const SQLITE_IOCAP_ATOMIC512: 2;
|
|
920
|
+
export const SQLITE_IOCAP_ATOMIC1K: 4;
|
|
921
|
+
export const SQLITE_IOCAP_ATOMIC2K: 8;
|
|
922
|
+
export const SQLITE_IOCAP_ATOMIC4K: 16;
|
|
923
|
+
export const SQLITE_IOCAP_ATOMIC8K: 32;
|
|
924
|
+
export const SQLITE_IOCAP_ATOMIC16K: 64;
|
|
925
|
+
export const SQLITE_IOCAP_ATOMIC32K: 128;
|
|
926
|
+
export const SQLITE_IOCAP_ATOMIC64K: 256;
|
|
927
|
+
export const SQLITE_IOCAP_SAFE_APPEND: 512;
|
|
928
|
+
export const SQLITE_IOCAP_SEQUENTIAL: 1024;
|
|
929
|
+
export const SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN: 2048;
|
|
930
|
+
export const SQLITE_IOCAP_POWERSAFE_OVERWRITE: 4096;
|
|
931
|
+
export const SQLITE_IOCAP_IMMUTABLE: 8192;
|
|
932
|
+
export const SQLITE_IOCAP_BATCH_ATOMIC: 16384;
|
|
933
|
+
export const SQLITE_ACCESS_EXISTS: 0;
|
|
934
|
+
export const SQLITE_ACCESS_READWRITE: 1;
|
|
935
|
+
export const SQLITE_ACCESS_READ: 2;
|
|
936
|
+
export const SQLITE_FCNTL_LOCKSTATE: 1;
|
|
937
|
+
export const SQLITE_FCNTL_GET_LOCKPROXYFILE: 2;
|
|
938
|
+
export const SQLITE_FCNTL_SET_LOCKPROXYFILE: 3;
|
|
939
|
+
export const SQLITE_FCNTL_LAST_ERRNO: 4;
|
|
940
|
+
export const SQLITE_FCNTL_SIZE_HINT: 5;
|
|
941
|
+
export const SQLITE_FCNTL_CHUNK_SIZE: 6;
|
|
942
|
+
export const SQLITE_FCNTL_FILE_POINTER: 7;
|
|
943
|
+
export const SQLITE_FCNTL_SYNC_OMITTED: 8;
|
|
944
|
+
export const SQLITE_FCNTL_WIN32_AV_RETRY: 9;
|
|
945
|
+
export const SQLITE_FCNTL_PERSIST_WAL: 10;
|
|
946
|
+
export const SQLITE_FCNTL_OVERWRITE: 11;
|
|
947
|
+
export const SQLITE_FCNTL_VFSNAME: 12;
|
|
948
|
+
export const SQLITE_FCNTL_POWERSAFE_OVERWRITE: 13;
|
|
949
|
+
export const SQLITE_FCNTL_PRAGMA: 14;
|
|
950
|
+
export const SQLITE_FCNTL_BUSYHANDLER: 15;
|
|
951
|
+
export const SQLITE_FCNTL_TEMPFILENAME: 16;
|
|
952
|
+
export const SQLITE_FCNTL_MMAP_SIZE: 18;
|
|
953
|
+
export const SQLITE_FCNTL_TRACE: 19;
|
|
954
|
+
export const SQLITE_FCNTL_HAS_MOVED: 20;
|
|
955
|
+
export const SQLITE_FCNTL_SYNC: 21;
|
|
956
|
+
export const SQLITE_FCNTL_COMMIT_PHASETWO: 22;
|
|
957
|
+
export const SQLITE_FCNTL_WIN32_SET_HANDLE: 23;
|
|
958
|
+
export const SQLITE_FCNTL_WAL_BLOCK: 24;
|
|
959
|
+
export const SQLITE_FCNTL_ZIPVFS: 25;
|
|
960
|
+
export const SQLITE_FCNTL_RBU: 26;
|
|
961
|
+
export const SQLITE_FCNTL_VFS_POINTER: 27;
|
|
962
|
+
export const SQLITE_FCNTL_JOURNAL_POINTER: 28;
|
|
963
|
+
export const SQLITE_FCNTL_WIN32_GET_HANDLE: 29;
|
|
964
|
+
export const SQLITE_FCNTL_PDB: 30;
|
|
965
|
+
export const SQLITE_FCNTL_BEGIN_ATOMIC_WRITE: 31;
|
|
966
|
+
export const SQLITE_FCNTL_COMMIT_ATOMIC_WRITE: 32;
|
|
967
|
+
export const SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE: 33;
|
|
968
|
+
export const SQLITE_FCNTL_LOCK_TIMEOUT: 34;
|
|
969
|
+
export const SQLITE_FCNTL_DATA_VERSION: 35;
|
|
970
|
+
export const SQLITE_FCNTL_SIZE_LIMIT: 36;
|
|
971
|
+
export const SQLITE_FCNTL_CKPT_DONE: 37;
|
|
972
|
+
export const SQLITE_FCNTL_RESERVE_BYTES: 38;
|
|
973
|
+
export const SQLITE_FCNTL_CKPT_START: 39;
|
|
974
|
+
export const SQLITE_INTEGER: 1;
|
|
975
|
+
export const SQLITE_FLOAT: 2;
|
|
976
|
+
export const SQLITE_TEXT: 3;
|
|
977
|
+
export const SQLITE_BLOB: 4;
|
|
978
|
+
export const SQLITE_NULL: 5;
|
|
979
|
+
export const SQLITE_STATIC: 0;
|
|
980
|
+
export const SQLITE_TRANSIENT: -1;
|
|
981
|
+
export const SQLITE_UTF8: 1;
|
|
982
|
+
export const SQLITE_UTF16LE: 2;
|
|
983
|
+
export const SQLITE_UTF16BE: 3;
|
|
984
|
+
export const SQLITE_UTF16: 4;
|
|
985
|
+
export const SQLITE_INDEX_CONSTRAINT_EQ: 2;
|
|
986
|
+
export const SQLITE_INDEX_CONSTRAINT_GT: 4;
|
|
987
|
+
export const SQLITE_INDEX_CONSTRAINT_LE: 8;
|
|
988
|
+
export const SQLITE_INDEX_CONSTRAINT_LT: 16;
|
|
989
|
+
export const SQLITE_INDEX_CONSTRAINT_GE: 32;
|
|
990
|
+
export const SQLITE_INDEX_CONSTRAINT_MATCH: 64;
|
|
991
|
+
export const SQLITE_INDEX_CONSTRAINT_LIKE: 65;
|
|
992
|
+
export const SQLITE_INDEX_CONSTRAINT_GLOB: 66;
|
|
993
|
+
export const SQLITE_INDEX_CONSTRAINT_REGEXP: 67;
|
|
994
|
+
export const SQLITE_INDEX_CONSTRAINT_NE: 68;
|
|
995
|
+
export const SQLITE_INDEX_CONSTRAINT_ISNOT: 69;
|
|
996
|
+
export const SQLITE_INDEX_CONSTRAINT_ISNOTNULL: 70;
|
|
997
|
+
export const SQLITE_INDEX_CONSTRAINT_ISNULL: 71;
|
|
998
|
+
export const SQLITE_INDEX_CONSTRAINT_IS: 72;
|
|
999
|
+
export const SQLITE_INDEX_CONSTRAINT_FUNCTION: 150;
|
|
1000
|
+
export const SQLITE_INDEX_SCAN_UNIQUE: 1;
|
|
1001
|
+
export const SQLITE_DETERMINISTIC: 0x000000800;
|
|
1002
|
+
export const SQLITE_DIRECTONLY: 0x000080000;
|
|
1003
|
+
export const SQLITE_SUBTYPE: 0x000100000;
|
|
1004
|
+
export const SQLITE_INNOCUOUS: 0x000200000;
|
|
1005
|
+
export const SQLITE_SYNC_NORMAL: 0x00002;
|
|
1006
|
+
export const SQLITE_SYNC_FULL: 0x00003;
|
|
1007
|
+
export const SQLITE_SYNC_DATAONLY: 0x00010;
|
|
1008
|
+
export const SQLITE_CREATE_INDEX: 1;
|
|
1009
|
+
export const SQLITE_CREATE_TABLE: 2;
|
|
1010
|
+
export const SQLITE_CREATE_TEMP_INDEX: 3;
|
|
1011
|
+
export const SQLITE_CREATE_TEMP_TABLE: 4;
|
|
1012
|
+
export const SQLITE_CREATE_TEMP_TRIGGER: 5;
|
|
1013
|
+
export const SQLITE_CREATE_TEMP_VIEW: 6;
|
|
1014
|
+
export const SQLITE_CREATE_TRIGGER: 7;
|
|
1015
|
+
export const SQLITE_CREATE_VIEW: 8;
|
|
1016
|
+
export const SQLITE_DELETE: 9;
|
|
1017
|
+
export const SQLITE_DROP_INDEX: 10;
|
|
1018
|
+
export const SQLITE_DROP_TABLE: 11;
|
|
1019
|
+
export const SQLITE_DROP_TEMP_INDEX: 12;
|
|
1020
|
+
export const SQLITE_DROP_TEMP_TABLE: 13;
|
|
1021
|
+
export const SQLITE_DROP_TEMP_TRIGGER: 14;
|
|
1022
|
+
export const SQLITE_DROP_TEMP_VIEW: 15;
|
|
1023
|
+
export const SQLITE_DROP_TRIGGER: 16;
|
|
1024
|
+
export const SQLITE_DROP_VIEW: 17;
|
|
1025
|
+
export const SQLITE_INSERT: 18;
|
|
1026
|
+
export const SQLITE_PRAGMA: 19;
|
|
1027
|
+
export const SQLITE_READ: 20;
|
|
1028
|
+
export const SQLITE_SELECT: 21;
|
|
1029
|
+
export const SQLITE_TRANSACTION: 22;
|
|
1030
|
+
export const SQLITE_UPDATE: 23;
|
|
1031
|
+
export const SQLITE_ATTACH: 24;
|
|
1032
|
+
export const SQLITE_DETACH: 25;
|
|
1033
|
+
export const SQLITE_ALTER_TABLE: 26;
|
|
1034
|
+
export const SQLITE_REINDEX: 27;
|
|
1035
|
+
export const SQLITE_ANALYZE: 28;
|
|
1036
|
+
export const SQLITE_CREATE_VTABLE: 29;
|
|
1037
|
+
export const SQLITE_DROP_VTABLE: 30;
|
|
1038
|
+
export const SQLITE_FUNCTION: 31;
|
|
1039
|
+
export const SQLITE_SAVEPOINT: 32;
|
|
1040
|
+
export const SQLITE_COPY: 0;
|
|
1041
|
+
export const SQLITE_RECURSIVE: 33;
|
|
1042
|
+
export const SQLITE_DENY: 1;
|
|
1043
|
+
export const SQLITE_IGNORE: 2;
|
|
1044
|
+
export const SQLITE_LIMIT_LENGTH: 0;
|
|
1045
|
+
export const SQLITE_LIMIT_SQL_LENGTH: 1;
|
|
1046
|
+
export const SQLITE_LIMIT_COLUMN: 2;
|
|
1047
|
+
export const SQLITE_LIMIT_EXPR_DEPTH: 3;
|
|
1048
|
+
export const SQLITE_LIMIT_COMPOUND_SELECT: 4;
|
|
1049
|
+
export const SQLITE_LIMIT_VDBE_OP: 5;
|
|
1050
|
+
export const SQLITE_LIMIT_FUNCTION_ARG: 6;
|
|
1051
|
+
export const SQLITE_LIMIT_ATTACHED: 7;
|
|
1052
|
+
export const SQLITE_LIMIT_LIKE_PATTERN_LENGTH: 8;
|
|
1053
|
+
export const SQLITE_LIMIT_VARIABLE_NUMBER: 9;
|
|
1054
|
+
export const SQLITE_LIMIT_TRIGGER_DEPTH: 10;
|
|
1055
|
+
export const SQLITE_LIMIT_WORKER_THREADS: 11;
|
|
1056
|
+
export const SQLITE_PREPARE_PERSISTENT: 0x01;
|
|
1057
|
+
export const SQLITE_PREPARE_NORMALIZED: 0x02;
|
|
1058
|
+
export const SQLITE_PREPARE_NO_VTAB: 0x04;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
declare module 'wa-sqlite' {
|
|
1062
|
+
export * from 'wa-sqlite/src/sqlite-constants.js';
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* @ignore
|
|
1066
|
+
* Builds a Javascript API from the Emscripten module. This API is still
|
|
1067
|
+
* low-level and closely corresponds to the C API exported by the module,
|
|
1068
|
+
* but differs in some specifics like throwing exceptions on errors.
|
|
1069
|
+
* @param {*} Module SQLite module
|
|
1070
|
+
* @returns {SQLiteAPI}
|
|
1071
|
+
*/
|
|
1072
|
+
export function Factory(Module: any): SQLiteAPI;
|
|
1073
|
+
|
|
1074
|
+
export class SQLiteError extends Error {
|
|
1075
|
+
constructor(message: any, code: any);
|
|
1076
|
+
code: any;
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
/** @ignore */
|
|
1081
|
+
declare module 'wa-sqlite/dist/wa-sqlite.mjs' {
|
|
1082
|
+
function ModuleFactory(config?: object): Promise<any>;
|
|
1083
|
+
export = ModuleFactory;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
/** @ignore */
|
|
1087
|
+
declare module 'wa-sqlite/dist/wa-sqlite-async.mjs' {
|
|
1088
|
+
function ModuleFactory(config?: object): Promise<any>;
|
|
1089
|
+
export = ModuleFactory;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/** @ignore */
|
|
1093
|
+
declare module 'wa-sqlite/src/VFS.js' {
|
|
1094
|
+
export * from 'wa-sqlite/src/sqlite-constants.js';
|
|
1095
|
+
|
|
1096
|
+
export class Base {
|
|
1097
|
+
mxPathName: number;
|
|
1098
|
+
/**
|
|
1099
|
+
* @param {number} fileId
|
|
1100
|
+
* @returns {number|Promise<number>}
|
|
1101
|
+
*/
|
|
1102
|
+
xClose(fileId: number): number;
|
|
1103
|
+
/**
|
|
1104
|
+
* @param {number} fileId
|
|
1105
|
+
* @param {Uint8Array} pData
|
|
1106
|
+
* @param {number} iOffset
|
|
1107
|
+
* @returns {number}
|
|
1108
|
+
*/
|
|
1109
|
+
xRead(fileId: number, pData: {
|
|
1110
|
+
size: number;
|
|
1111
|
+
value: Uint8Array;
|
|
1112
|
+
}, iOffset: number): number;
|
|
1113
|
+
/**
|
|
1114
|
+
* @param {number} fileId
|
|
1115
|
+
* @param {Uint8Array} pData
|
|
1116
|
+
* @param {number} iOffset
|
|
1117
|
+
* @returns {number}
|
|
1118
|
+
*/
|
|
1119
|
+
xWrite(fileId: number, pData: {
|
|
1120
|
+
size: number;
|
|
1121
|
+
value: Uint8Array;
|
|
1122
|
+
}, iOffset: number): number;
|
|
1123
|
+
/**
|
|
1124
|
+
* @param {number} fileId
|
|
1125
|
+
* @param {number} iSize
|
|
1126
|
+
* @returns {number}
|
|
1127
|
+
*/
|
|
1128
|
+
xTruncate(fileId: number, iSize: number): number;
|
|
1129
|
+
/**
|
|
1130
|
+
* @param {number} fileId
|
|
1131
|
+
* @param {*} flags
|
|
1132
|
+
* @returns {number}
|
|
1133
|
+
*/
|
|
1134
|
+
xSync(fileId: number, flags: any): number;
|
|
1135
|
+
/**
|
|
1136
|
+
* @param {number} fileId
|
|
1137
|
+
* @param {DataView} pSize64
|
|
1138
|
+
* @returns {number|Promise<number>}
|
|
1139
|
+
*/
|
|
1140
|
+
xFileSize(fileId: number, pSize64: DataView): number;
|
|
1141
|
+
/**
|
|
1142
|
+
* @param {number} fileId
|
|
1143
|
+
* @param {number} flags
|
|
1144
|
+
* @returns {number}
|
|
1145
|
+
*/
|
|
1146
|
+
xLock(fileId: number, flags: number): number;
|
|
1147
|
+
/**
|
|
1148
|
+
* @param {number} fileId
|
|
1149
|
+
* @param {number} flags
|
|
1150
|
+
* @returns {number}
|
|
1151
|
+
*/
|
|
1152
|
+
xUnlock(fileId: number, flags: number): number;
|
|
1153
|
+
/**
|
|
1154
|
+
* @param {number} fileId
|
|
1155
|
+
* @param {DataView} pResOut
|
|
1156
|
+
* @returns {number}
|
|
1157
|
+
*/
|
|
1158
|
+
xCheckReservedLock(fileId: number, pResOut: DataView): number;
|
|
1159
|
+
/**
|
|
1160
|
+
* @param {number} fileId
|
|
1161
|
+
* @param {number} flags
|
|
1162
|
+
* @param {DataView} pArg
|
|
1163
|
+
* @returns {number}
|
|
1164
|
+
*/
|
|
1165
|
+
xFileControl(fileId: number, flags: number, pArg: DataView): number;
|
|
1166
|
+
/**
|
|
1167
|
+
* @param {number} fileId
|
|
1168
|
+
* @returns {number}
|
|
1169
|
+
*/
|
|
1170
|
+
xSectorSize(fileId: number): number;
|
|
1171
|
+
/**
|
|
1172
|
+
* @param {number} fileId
|
|
1173
|
+
* @returns {number}
|
|
1174
|
+
*/
|
|
1175
|
+
xDeviceCharacteristics(fileId: number): number;
|
|
1176
|
+
/**
|
|
1177
|
+
* @param {string?} name
|
|
1178
|
+
* @param {number} fileId
|
|
1179
|
+
* @param {number} flags
|
|
1180
|
+
* @param {DataView} pOutFlags
|
|
1181
|
+
* @returns {number}
|
|
1182
|
+
*/
|
|
1183
|
+
xOpen(name: string | null, fileId: number, flags: number, pOutFlags: DataView): number;
|
|
1184
|
+
/**
|
|
1185
|
+
*
|
|
1186
|
+
* @param {string} name
|
|
1187
|
+
* @param {number} syncDir
|
|
1188
|
+
* @returns {number}
|
|
1189
|
+
*/
|
|
1190
|
+
xDelete(name: string, syncDir: number): number;
|
|
1191
|
+
/**
|
|
1192
|
+
* @param {string} name
|
|
1193
|
+
* @param {number} flags
|
|
1194
|
+
* @param {DataView} pResOut
|
|
1195
|
+
* @returns {number}
|
|
1196
|
+
*/
|
|
1197
|
+
xAccess(name: string, flags: number, pResOut: DataView): number;
|
|
1198
|
+
/**
|
|
1199
|
+
* Handle asynchronous operation. This implementation will be overriden on
|
|
1200
|
+
* registration by an Asyncify build.
|
|
1201
|
+
* @param {function(): Promise<number>} f
|
|
1202
|
+
* @returns {number}
|
|
1203
|
+
*/
|
|
1204
|
+
handleAsync(f: () => Promise<number>): number;
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
/** @ignore */
|
|
1209
|
+
declare module 'wa-sqlite/src/examples/IndexedDbVFS.js' {
|
|
1210
|
+
import * as VFS from "wa-sqlite/src/VFS.js";
|
|
1211
|
+
export class IndexedDbVFS extends VFS.Base {
|
|
1212
|
+
/**
|
|
1213
|
+
* @param {string} idbName Name of IndexedDB database.
|
|
1214
|
+
*/
|
|
1215
|
+
constructor(idbName?: string);
|
|
1216
|
+
name: string;
|
|
1217
|
+
mapIdToFile: Map<any, any>;
|
|
1218
|
+
cacheSize: number;
|
|
1219
|
+
db: any;
|
|
1220
|
+
// close(): Promise<void>;
|
|
1221
|
+
close(): void;
|
|
1222
|
+
/**
|
|
1223
|
+
* Delete a file from IndexedDB.
|
|
1224
|
+
* @param {string} name
|
|
1225
|
+
*/
|
|
1226
|
+
deleteFile(name: string): Promise<void>;
|
|
1227
|
+
/**
|
|
1228
|
+
* Forcibly clear an orphaned file lock.
|
|
1229
|
+
* @param {string} name
|
|
1230
|
+
*/
|
|
1231
|
+
forceClearLock(name: string): Promise<void>;
|
|
1232
|
+
_getStore(mode?: string): any;
|
|
1233
|
+
/**
|
|
1234
|
+
* Returns the key for file metadata.
|
|
1235
|
+
* @param {string} name
|
|
1236
|
+
* @returns
|
|
1237
|
+
*/
|
|
1238
|
+
_metaKey(name: string): string;
|
|
1239
|
+
/**
|
|
1240
|
+
* Returns the key for file block data.
|
|
1241
|
+
* @param {string} name
|
|
1242
|
+
* @param {number} index
|
|
1243
|
+
* @returns
|
|
1244
|
+
*/
|
|
1245
|
+
_blockKey(name: string, index: number): string;
|
|
1246
|
+
_getBlock(store: any, file: any, index: any): Promise<any>;
|
|
1247
|
+
_putBlock(store: any, file: any, index: any, blockData: any): void;
|
|
1248
|
+
_purgeCache(store: any, file: any, size?: number): void;
|
|
1249
|
+
_flushCache(store: any, file: any): Promise<void>;
|
|
1250
|
+
_sync(file: any): Promise<void>;
|
|
1251
|
+
/**
|
|
1252
|
+
* Helper function that deletes all keys greater or equal to `key`
|
|
1253
|
+
* provided they start with `prefix`.
|
|
1254
|
+
* @param {string} key
|
|
1255
|
+
* @param {string} [prefix]
|
|
1256
|
+
* @returns
|
|
1257
|
+
*/
|
|
1258
|
+
_delete(key: string, prefix?: string): Promise<any>;
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
/** @ignore */
|
|
1263
|
+
declare module 'wa-sqlite/src/examples/MemoryVFS.js' {
|
|
1264
|
+
import * as VFS from "wa-sqlite/src/VFS.js";
|
|
1265
|
+
/** @ignore */
|
|
1266
|
+
export class MemoryVFS extends VFS.Base {
|
|
1267
|
+
name: string;
|
|
1268
|
+
mapNameToFile: Map<any, any>;
|
|
1269
|
+
mapIdToFile: Map<any, any>;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
/** @ignore */
|
|
1274
|
+
declare module 'wa-sqlite/src/examples/MemoryAsyncVFS.js' {
|
|
1275
|
+
import { MemoryVFS } from "wa-sqlite/src/examples/MemoryVFS.js";
|
|
1276
|
+
export class MemoryAsyncVFS extends MemoryVFS {
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
/** @ignore */
|
|
1281
|
+
declare module 'wa-sqlite/src/examples/tag.js' {
|
|
1282
|
+
/**
|
|
1283
|
+
* @ignore
|
|
1284
|
+
* Template tag builder. This function creates a tag with an API and
|
|
1285
|
+
* database from the same module, then the tag can be used like this:
|
|
1286
|
+
* ```
|
|
1287
|
+
* const sql = tag(sqlite3, db);
|
|
1288
|
+
* const results = await sql`
|
|
1289
|
+
* SELECT 1 + 1;
|
|
1290
|
+
* SELECT 6 * 7;
|
|
1291
|
+
* `;
|
|
1292
|
+
* ```
|
|
1293
|
+
* The returned Promise value contains an array of results for each
|
|
1294
|
+
* SQL statement that produces output. Each result is an object with
|
|
1295
|
+
* properties `columns` (array of names) and `rows` (array of array
|
|
1296
|
+
* of values).
|
|
1297
|
+
* @param {SQLiteAPI} sqlite3
|
|
1298
|
+
* @param {number} db
|
|
1299
|
+
* @returns {function(TemplateStringsArray, ...any): Promise<object[]>}
|
|
1300
|
+
*/
|
|
1301
|
+
export function tag(sqlite3: any, db: number): (arg0: TemplateStringsArray, ...args: any[]) => Promise<object[]>;
|
|
1302
|
+
}
|