@evolu/sqlite-wasm 2.2.4 → 3.53.4-build1

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.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +55 -218
  3. package/dist/src/CApi.d.ts +2108 -0
  4. package/dist/src/CApi.d.ts.map +1 -0
  5. package/dist/src/CApi.js +1919 -0
  6. package/dist/src/Constants.d.ts +868 -0
  7. package/dist/src/Constants.d.ts.map +1 -0
  8. package/dist/src/Constants.js +602 -0
  9. package/dist/src/Database.d.ts +641 -0
  10. package/dist/src/Database.d.ts.map +1 -0
  11. package/dist/src/Database.js +1177 -0
  12. package/dist/src/Memory.d.ts +119 -0
  13. package/dist/src/Memory.d.ts.map +1 -0
  14. package/dist/src/Memory.js +207 -0
  15. package/dist/src/Pointer.d.ts +100 -0
  16. package/dist/src/Pointer.d.ts.map +1 -0
  17. package/dist/src/Pointer.js +15 -0
  18. package/dist/src/SahPool.d.ts +744 -0
  19. package/dist/src/SahPool.d.ts.map +1 -0
  20. package/dist/src/SahPool.js +1985 -0
  21. package/dist/src/Wasm.d.ts +315 -0
  22. package/dist/src/Wasm.d.ts.map +1 -0
  23. package/dist/src/Wasm.js +756 -0
  24. package/dist/src/WasmUrl.d.ts +21 -0
  25. package/dist/src/WasmUrl.d.ts.map +1 -0
  26. package/dist/src/WasmUrl.js +20 -0
  27. package/dist/src/c-api/index.d.ts +9 -0
  28. package/dist/src/c-api/index.d.ts.map +1 -0
  29. package/dist/src/c-api/index.js +8 -0
  30. package/dist/src/index.d.ts +15 -0
  31. package/dist/src/index.d.ts.map +1 -0
  32. package/dist/src/index.js +13 -0
  33. package/dist/wasm/sqlite3.wasm +0 -0
  34. package/package.json +60 -60
  35. package/src/CApi.test.ts +217 -0
  36. package/src/CApi.ts +3294 -0
  37. package/src/Constants.ts +803 -0
  38. package/src/Database.ts +1714 -0
  39. package/src/Memory.test.ts +319 -0
  40. package/src/Memory.ts +237 -0
  41. package/src/Pointer.ts +121 -0
  42. package/src/SahPool.test.ts +180 -0
  43. package/src/SahPool.ts +2627 -0
  44. package/src/Wasm.test.ts +444 -0
  45. package/src/Wasm.ts +1026 -0
  46. package/src/WasmUrl.ts +26 -0
  47. package/src/c-api/index.ts +9 -0
  48. package/src/index.ts +15 -0
  49. package/bin/index.js +0 -110
  50. package/index.d.ts +0 -8118
  51. package/index.mjs +0 -7
  52. package/node.mjs +0 -3
  53. package/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs +0 -13659
  54. package/sqlite-wasm/jswasm/sqlite3-node.mjs +0 -11671
  55. package/sqlite-wasm/jswasm/sqlite3-opfs-async-proxy.js +0 -691
  56. package/sqlite-wasm/jswasm/sqlite3-worker1-bundler-friendly.mjs +0 -35
  57. package/sqlite-wasm/jswasm/sqlite3-worker1-promiser.js +0 -193
  58. package/sqlite-wasm/jswasm/sqlite3-worker1-promiser.mjs +0 -187
  59. package/sqlite-wasm/jswasm/sqlite3-worker1.js +0 -46
  60. package/sqlite-wasm/jswasm/sqlite3.js +0 -13697
  61. package/sqlite-wasm/jswasm/sqlite3.mjs +0 -13661
  62. package/sqlite-wasm/jswasm/sqlite3.wasm +0 -0
package/src/CApi.ts ADDED
@@ -0,0 +1,3294 @@
1
+ /**
2
+ * SQLite's C API as standalone functions: one for every public C function the
3
+ * binary exports, and one for each of the variadic {@link sqlite3_config},
4
+ * {@link sqlite3_db_config} and {@link sqlite3_vtab_config}, which the binary
5
+ * exports only as the build's `sqlite3__wasm_*` shims.
6
+ *
7
+ * Each function takes {@link SqliteWasmDep} and returns the wasm export itself,
8
+ * typed with branded pointers and raw result codes, so a call costs no
9
+ * JavaScript wrapper. A variadic function whose options need different shims
10
+ * returns a function that passes each option to its shim, as SQLite's
11
+ * JavaScript does. Bind once per database, never per row. Strings are C string
12
+ * pointers; nothing allocates implicitly. A callback parameter takes a function
13
+ * pointer, such as one {@link installWasmFunctions} returns.
14
+ *
15
+ * Each function's documentation gives its wasm type and its signature in the
16
+ * syntax of SQLite's table, where `funcptr:` and the callback's signature stand
17
+ * for a callback argument.
18
+ *
19
+ * Generated by `scripts/generate.mts` from SQLite's own signature table in
20
+ * `scripts/upstream/sqlite3-api-glue.c-pp.js` and the metadata in
21
+ * `scripts/bindings.mts`, with every wasm type checked against the binary's
22
+ * pinned exports. Do not edit.
23
+ *
24
+ * @module
25
+ */
26
+
27
+ import {
28
+ SQLITE_CONFIG_COVERING_INDEX_SCAN,
29
+ SQLITE_CONFIG_LOOKASIDE,
30
+ SQLITE_CONFIG_MEMDB_MAXSIZE,
31
+ SQLITE_CONFIG_MEMSTATUS,
32
+ SQLITE_CONFIG_SMALL_MALLOC,
33
+ SQLITE_CONFIG_SORTERREF_SIZE,
34
+ SQLITE_CONFIG_STMTJRNL_SPILL,
35
+ SQLITE_CONFIG_URI,
36
+ SQLITE_DBCONFIG_DEFENSIVE,
37
+ SQLITE_DBCONFIG_DQS_DDL,
38
+ SQLITE_DBCONFIG_DQS_DML,
39
+ SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE,
40
+ SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE,
41
+ SQLITE_DBCONFIG_ENABLE_COMMENTS,
42
+ SQLITE_DBCONFIG_ENABLE_FKEY,
43
+ SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION,
44
+ SQLITE_DBCONFIG_ENABLE_QPSG,
45
+ SQLITE_DBCONFIG_ENABLE_TRIGGER,
46
+ SQLITE_DBCONFIG_ENABLE_VIEW,
47
+ SQLITE_DBCONFIG_FP_DIGITS,
48
+ SQLITE_DBCONFIG_LEGACY_ALTER_TABLE,
49
+ SQLITE_DBCONFIG_LEGACY_FILE_FORMAT,
50
+ SQLITE_DBCONFIG_LOOKASIDE,
51
+ SQLITE_DBCONFIG_MAINDBNAME,
52
+ SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE,
53
+ SQLITE_DBCONFIG_RESET_DATABASE,
54
+ SQLITE_DBCONFIG_REVERSE_SCANORDER,
55
+ SQLITE_DBCONFIG_STMT_SCANSTATUS,
56
+ SQLITE_DBCONFIG_TRIGGER_EQP,
57
+ SQLITE_DBCONFIG_TRUSTED_SCHEMA,
58
+ SQLITE_DBCONFIG_WRITABLE_SCHEMA,
59
+ SQLITE_MISUSE,
60
+ SQLITE_NOTFOUND,
61
+ type SQLITE_VTAB_CONSTRAINT_SUPPORT,
62
+ type SQLITE_VTAB_DIRECTONLY,
63
+ type SQLITE_VTAB_INNOCUOUS,
64
+ type SqliteDataType,
65
+ type SqliteResultCode,
66
+ } from "./Constants.ts";
67
+ import type {
68
+ CStringPtr,
69
+ NullPtr,
70
+ SqliteContextPtr,
71
+ SqliteDbPtr,
72
+ SqliteDestructor,
73
+ SqliteFilenamePtr,
74
+ SqliteFunctionPtr,
75
+ SqliteIndexInfoPtr,
76
+ SqliteOwnedCStringPtr,
77
+ SqliteOwnedPtr,
78
+ SqliteOwnedValuePtr,
79
+ SqliteStmtPtr,
80
+ SqliteValuePtr,
81
+ SqliteVfsPtr,
82
+ WasmPtr,
83
+ } from "./Pointer.ts";
84
+ import type { SqliteWasmDep, installWasmFunctions } from "./Wasm.ts";
85
+
86
+ /**
87
+ * The C functions this package binds, and the build's shims of the variadic
88
+ * ones, as the wasm exports them.
89
+ */
90
+ export interface SqliteCExports {
91
+ readonly sqlite3_initialize: () => SqliteResultCode;
92
+ readonly sqlite3_shutdown: () => SqliteResultCode;
93
+ readonly sqlite3_libversion: () => CStringPtr;
94
+ readonly sqlite3_libversion_number: () => number;
95
+ readonly sqlite3_sourceid: () => CStringPtr;
96
+ readonly sqlite3_compileoption_get: (N: number) => CStringPtr | NullPtr;
97
+ readonly sqlite3_compileoption_used: (zOptName: CStringPtr) => number;
98
+ readonly sqlite3_status: (
99
+ op: number,
100
+ pCurrent: WasmPtr,
101
+ pHighwater: WasmPtr,
102
+ resetFlag: number,
103
+ ) => SqliteResultCode;
104
+ readonly sqlite3_status64: (
105
+ op: number,
106
+ pCurrent: WasmPtr,
107
+ pHighwater: WasmPtr,
108
+ resetFlag: number,
109
+ ) => SqliteResultCode;
110
+ readonly sqlite3_auto_extension: (
111
+ xEntryPoint: SqliteFunctionPtr,
112
+ ) => SqliteResultCode;
113
+ readonly sqlite3_cancel_auto_extension: (
114
+ xEntryPoint: SqliteFunctionPtr,
115
+ ) => number;
116
+ readonly sqlite3_reset_auto_extension: () => void;
117
+ readonly sqlite3_randomness: (N: number, P: WasmPtr | NullPtr) => void;
118
+ readonly sqlite3_complete: (sql: CStringPtr) => number;
119
+ readonly sqlite3_keyword_count: () => number;
120
+ readonly sqlite3_keyword_name: (
121
+ index: number,
122
+ pzName: WasmPtr,
123
+ pnName: WasmPtr,
124
+ ) => SqliteResultCode;
125
+ readonly sqlite3_keyword_check: (zName: WasmPtr, nName: number) => number;
126
+ readonly sqlite3_strglob: (zGlob: CStringPtr, zStr: CStringPtr) => number;
127
+ readonly sqlite3_strlike: (
128
+ zGlob: CStringPtr,
129
+ zStr: CStringPtr,
130
+ cEsc: number,
131
+ ) => number;
132
+ readonly sqlite3_stricmp: (zLeft: CStringPtr, zRight: CStringPtr) => number;
133
+ readonly sqlite3_strnicmp: (
134
+ zLeft: CStringPtr,
135
+ zRight: CStringPtr,
136
+ N: number,
137
+ ) => number;
138
+ readonly sqlite3_malloc: (byteLength: number) => SqliteOwnedPtr | NullPtr;
139
+ readonly sqlite3_malloc64: (byteLength: bigint) => SqliteOwnedPtr | NullPtr;
140
+ readonly sqlite3_realloc: (
141
+ ptr: SqliteOwnedPtr | NullPtr,
142
+ byteLength: number,
143
+ ) => SqliteOwnedPtr | NullPtr;
144
+ readonly sqlite3_realloc64: (
145
+ ptr: SqliteOwnedPtr | NullPtr,
146
+ byteLength: bigint,
147
+ ) => SqliteOwnedPtr | NullPtr;
148
+ readonly sqlite3_msize: (ptr: SqliteOwnedPtr | NullPtr) => bigint;
149
+ readonly sqlite3_free: (ptr: SqliteOwnedPtr | NullPtr) => void;
150
+ readonly sqlite3_open: (
151
+ filename: CStringPtr,
152
+ ppDb: WasmPtr,
153
+ ) => SqliteResultCode;
154
+ readonly sqlite3_open_v2: (
155
+ filename: CStringPtr,
156
+ ppDb: WasmPtr,
157
+ flags: number,
158
+ zVfs: CStringPtr | NullPtr,
159
+ ) => SqliteResultCode;
160
+ readonly sqlite3_close_v2: (db: SqliteDbPtr | NullPtr) => SqliteResultCode;
161
+ readonly sqlite3_db_filename: (
162
+ db: SqliteDbPtr,
163
+ zDbName: CStringPtr,
164
+ ) => SqliteFilenamePtr | NullPtr;
165
+ readonly sqlite3_db_name: (
166
+ db: SqliteDbPtr,
167
+ N: number,
168
+ ) => CStringPtr | NullPtr;
169
+ readonly sqlite3_db_readonly: (
170
+ db: SqliteDbPtr,
171
+ zDbName: CStringPtr,
172
+ ) => number;
173
+ readonly sqlite3_txn_state: (
174
+ db: SqliteDbPtr,
175
+ zSchema: CStringPtr | NullPtr,
176
+ ) => number;
177
+ readonly sqlite3_get_autocommit: (db: SqliteDbPtr) => number;
178
+ readonly sqlite3_limit: (
179
+ db: SqliteDbPtr,
180
+ id: number,
181
+ newVal: number,
182
+ ) => number;
183
+ readonly sqlite3_busy_handler: (
184
+ db: SqliteDbPtr,
185
+ xBusy: SqliteFunctionPtr | NullPtr,
186
+ pArg: WasmPtr | NullPtr,
187
+ ) => SqliteResultCode;
188
+ readonly sqlite3_busy_timeout: (
189
+ db: SqliteDbPtr,
190
+ ms: number,
191
+ ) => SqliteResultCode;
192
+ readonly sqlite3_interrupt: (db: SqliteDbPtr) => void;
193
+ readonly sqlite3_is_interrupted: (db: SqliteDbPtr) => number;
194
+ readonly sqlite3_extended_result_codes: (
195
+ db: SqliteDbPtr,
196
+ onoff: number,
197
+ ) => SqliteResultCode;
198
+ readonly sqlite3_file_control: (
199
+ db: SqliteDbPtr,
200
+ zDbName: CStringPtr | NullPtr,
201
+ op: number,
202
+ pArg: WasmPtr | NullPtr,
203
+ ) => SqliteResultCode;
204
+ readonly sqlite3_table_column_metadata: (
205
+ db: SqliteDbPtr,
206
+ zDbName: CStringPtr | NullPtr,
207
+ zTableName: CStringPtr,
208
+ zColumnName: CStringPtr | NullPtr,
209
+ pzDataType: WasmPtr | NullPtr,
210
+ pzCollSeq: WasmPtr | NullPtr,
211
+ pNotNull: WasmPtr | NullPtr,
212
+ pPrimaryKey: WasmPtr | NullPtr,
213
+ pAutoinc: WasmPtr | NullPtr,
214
+ ) => SqliteResultCode;
215
+ readonly sqlite3_db_status: (
216
+ db: SqliteDbPtr,
217
+ op: number,
218
+ pCur: WasmPtr,
219
+ pHiwtr: WasmPtr,
220
+ resetFlg: number,
221
+ ) => SqliteResultCode;
222
+ readonly sqlite3_db_status64: (
223
+ db: SqliteDbPtr,
224
+ op: number,
225
+ pCur: WasmPtr,
226
+ pHiwtr: WasmPtr,
227
+ resetFlg: number,
228
+ ) => SqliteResultCode;
229
+ readonly sqlite3_last_insert_rowid: (db: SqliteDbPtr) => bigint;
230
+ readonly sqlite3_set_last_insert_rowid: (
231
+ db: SqliteDbPtr,
232
+ rowid: bigint,
233
+ ) => void;
234
+ readonly sqlite3_changes: (db: SqliteDbPtr) => number;
235
+ readonly sqlite3_changes64: (db: SqliteDbPtr) => bigint;
236
+ readonly sqlite3_total_changes: (db: SqliteDbPtr) => number;
237
+ readonly sqlite3_total_changes64: (db: SqliteDbPtr) => bigint;
238
+ readonly sqlite3_exec: (
239
+ db: SqliteDbPtr,
240
+ sql: CStringPtr | NullPtr,
241
+ callback: SqliteFunctionPtr | NullPtr,
242
+ pArg: WasmPtr | NullPtr,
243
+ errmsg: WasmPtr | NullPtr,
244
+ ) => SqliteResultCode;
245
+ readonly sqlite3_serialize: {
246
+ (
247
+ db: SqliteDbPtr,
248
+ zSchema: CStringPtr | NullPtr,
249
+ piSize: WasmPtr | NullPtr,
250
+ mFlags: 0,
251
+ ): SqliteOwnedPtr | NullPtr;
252
+ (
253
+ db: SqliteDbPtr,
254
+ zSchema: CStringPtr | NullPtr,
255
+ piSize: WasmPtr | NullPtr,
256
+ mFlags: number,
257
+ ): WasmPtr | NullPtr;
258
+ };
259
+ readonly sqlite3_deserialize: (
260
+ db: SqliteDbPtr,
261
+ zSchema: CStringPtr | NullPtr,
262
+ pData: WasmPtr,
263
+ szDb: bigint,
264
+ szBuf: bigint,
265
+ mFlags: number,
266
+ ) => SqliteResultCode;
267
+ readonly sqlite3_errcode: (db: SqliteDbPtr) => SqliteResultCode;
268
+ readonly sqlite3_extended_errcode: (db: SqliteDbPtr) => SqliteResultCode;
269
+ readonly sqlite3_errmsg: (db: SqliteDbPtr) => CStringPtr | NullPtr;
270
+ readonly sqlite3_errstr: (code: SqliteResultCode) => CStringPtr | NullPtr;
271
+ readonly sqlite3_error_offset: (db: SqliteDbPtr) => number;
272
+ readonly sqlite3_set_errmsg: (
273
+ db: SqliteDbPtr,
274
+ errcode: SqliteResultCode,
275
+ zErrMsg: CStringPtr | NullPtr,
276
+ ) => SqliteResultCode;
277
+ readonly sqlite3_commit_hook: (
278
+ db: SqliteDbPtr,
279
+ xCallback: SqliteFunctionPtr | NullPtr,
280
+ pArg: WasmPtr | NullPtr,
281
+ ) => WasmPtr | NullPtr;
282
+ readonly sqlite3_rollback_hook: (
283
+ db: SqliteDbPtr,
284
+ xCallback: SqliteFunctionPtr | NullPtr,
285
+ pArg: WasmPtr | NullPtr,
286
+ ) => WasmPtr | NullPtr;
287
+ readonly sqlite3_update_hook: (
288
+ db: SqliteDbPtr,
289
+ xCallback: SqliteFunctionPtr | NullPtr,
290
+ pArg: WasmPtr | NullPtr,
291
+ ) => WasmPtr | NullPtr;
292
+ readonly sqlite3_trace_v2: (
293
+ db: SqliteDbPtr,
294
+ uMask: number,
295
+ xCallback: SqliteFunctionPtr | NullPtr,
296
+ pCtx: WasmPtr | NullPtr,
297
+ ) => SqliteResultCode;
298
+ readonly sqlite3_collation_needed: (
299
+ db: SqliteDbPtr,
300
+ pArg: WasmPtr | NullPtr,
301
+ xCollNeeded: SqliteFunctionPtr | NullPtr,
302
+ ) => SqliteResultCode;
303
+ readonly sqlite3_prepare_v2: (
304
+ db: SqliteDbPtr,
305
+ zSql: WasmPtr,
306
+ nByte: number,
307
+ ppStmt: WasmPtr,
308
+ pzTail: WasmPtr | NullPtr,
309
+ ) => SqliteResultCode;
310
+ readonly sqlite3_prepare_v3: (
311
+ db: SqliteDbPtr,
312
+ zSql: WasmPtr,
313
+ nByte: number,
314
+ prepFlags: number,
315
+ ppStmt: WasmPtr,
316
+ pzTail: WasmPtr | NullPtr,
317
+ ) => SqliteResultCode;
318
+ readonly sqlite3_step: (pStmt: SqliteStmtPtr) => SqliteResultCode;
319
+ readonly sqlite3_reset: (pStmt: SqliteStmtPtr) => SqliteResultCode;
320
+ readonly sqlite3_finalize: (
321
+ pStmt: SqliteStmtPtr | NullPtr,
322
+ ) => SqliteResultCode;
323
+ readonly sqlite3_next_stmt: (
324
+ pDb: SqliteDbPtr,
325
+ pStmt: SqliteStmtPtr | NullPtr,
326
+ ) => SqliteStmtPtr | NullPtr;
327
+ readonly sqlite3_db_handle: (pStmt: SqliteStmtPtr) => SqliteDbPtr;
328
+ readonly sqlite3_sql: (pStmt: SqliteStmtPtr) => CStringPtr | NullPtr;
329
+ readonly sqlite3_expanded_sql: (
330
+ pStmt: SqliteStmtPtr,
331
+ ) => SqliteOwnedCStringPtr | NullPtr;
332
+ readonly sqlite3_stmt_busy: (pStmt: SqliteStmtPtr | NullPtr) => number;
333
+ readonly sqlite3_stmt_readonly: (pStmt: SqliteStmtPtr) => number;
334
+ readonly sqlite3_stmt_explain: (
335
+ pStmt: SqliteStmtPtr,
336
+ eMode: number,
337
+ ) => SqliteResultCode;
338
+ readonly sqlite3_stmt_isexplain: (pStmt: SqliteStmtPtr | NullPtr) => number;
339
+ readonly sqlite3_stmt_status: (
340
+ pStmt: SqliteStmtPtr,
341
+ op: number,
342
+ resetFlg: number,
343
+ ) => number;
344
+ readonly sqlite3_bind_parameter_count: (pStmt: SqliteStmtPtr) => number;
345
+ readonly sqlite3_bind_parameter_index: (
346
+ pStmt: SqliteStmtPtr,
347
+ zName: CStringPtr,
348
+ ) => number;
349
+ readonly sqlite3_bind_parameter_name: (
350
+ pStmt: SqliteStmtPtr,
351
+ index: number,
352
+ ) => CStringPtr | NullPtr;
353
+ readonly sqlite3_bind_null: (
354
+ pStmt: SqliteStmtPtr,
355
+ index: number,
356
+ ) => SqliteResultCode;
357
+ readonly sqlite3_bind_int: (
358
+ pStmt: SqliteStmtPtr,
359
+ index: number,
360
+ value: number,
361
+ ) => SqliteResultCode;
362
+ readonly sqlite3_bind_int64: (
363
+ pStmt: SqliteStmtPtr,
364
+ index: number,
365
+ value: bigint,
366
+ ) => SqliteResultCode;
367
+ readonly sqlite3_bind_double: (
368
+ pStmt: SqliteStmtPtr,
369
+ index: number,
370
+ value: number,
371
+ ) => SqliteResultCode;
372
+ readonly sqlite3_bind_text: (
373
+ pStmt: SqliteStmtPtr,
374
+ index: number,
375
+ value: WasmPtr | NullPtr,
376
+ n: number,
377
+ destructor: SqliteDestructor,
378
+ ) => SqliteResultCode;
379
+ readonly sqlite3_bind_blob: (
380
+ pStmt: SqliteStmtPtr,
381
+ index: number,
382
+ value: WasmPtr | NullPtr,
383
+ n: number,
384
+ destructor: SqliteDestructor,
385
+ ) => SqliteResultCode;
386
+ readonly sqlite3_bind_zeroblob: (
387
+ pStmt: SqliteStmtPtr,
388
+ index: number,
389
+ n: number,
390
+ ) => SqliteResultCode;
391
+ readonly sqlite3_bind_pointer: (
392
+ pStmt: SqliteStmtPtr,
393
+ index: number,
394
+ pPtr: WasmPtr | NullPtr,
395
+ zPType: CStringPtr,
396
+ xDestructor: SqliteFunctionPtr | NullPtr,
397
+ ) => SqliteResultCode;
398
+ readonly sqlite3_clear_bindings: (pStmt: SqliteStmtPtr) => SqliteResultCode;
399
+ readonly sqlite3_column_count: (pStmt: SqliteStmtPtr) => number;
400
+ readonly sqlite3_data_count: (pStmt: SqliteStmtPtr | NullPtr) => number;
401
+ readonly sqlite3_column_name: (
402
+ pStmt: SqliteStmtPtr,
403
+ N: number,
404
+ ) => CStringPtr | NullPtr;
405
+ readonly sqlite3_column_decltype: (
406
+ pStmt: SqliteStmtPtr,
407
+ iCol: number,
408
+ ) => CStringPtr | NullPtr;
409
+ readonly sqlite3_column_type: (
410
+ pStmt: SqliteStmtPtr,
411
+ iCol: number,
412
+ ) => SqliteDataType;
413
+ readonly sqlite3_column_int: (pStmt: SqliteStmtPtr, iCol: number) => number;
414
+ readonly sqlite3_column_int64: (pStmt: SqliteStmtPtr, iCol: number) => bigint;
415
+ readonly sqlite3_column_double: (
416
+ pStmt: SqliteStmtPtr,
417
+ iCol: number,
418
+ ) => number;
419
+ readonly sqlite3_column_text: (
420
+ pStmt: SqliteStmtPtr,
421
+ iCol: number,
422
+ ) => WasmPtr | NullPtr;
423
+ readonly sqlite3_column_blob: (
424
+ pStmt: SqliteStmtPtr,
425
+ iCol: number,
426
+ ) => WasmPtr | NullPtr;
427
+ readonly sqlite3_column_bytes: (pStmt: SqliteStmtPtr, iCol: number) => number;
428
+ readonly sqlite3_column_value: (
429
+ pStmt: SqliteStmtPtr,
430
+ iCol: number,
431
+ ) => SqliteValuePtr;
432
+ readonly sqlite3_value_type: (value: SqliteValuePtr) => SqliteDataType;
433
+ readonly sqlite3_value_numeric_type: (
434
+ value: SqliteValuePtr,
435
+ ) => SqliteDataType;
436
+ readonly sqlite3_value_int: (value: SqliteValuePtr) => number;
437
+ readonly sqlite3_value_int64: (value: SqliteValuePtr) => bigint;
438
+ readonly sqlite3_value_double: (value: SqliteValuePtr) => number;
439
+ readonly sqlite3_value_text: (value: SqliteValuePtr) => WasmPtr | NullPtr;
440
+ readonly sqlite3_value_blob: (value: SqliteValuePtr) => WasmPtr | NullPtr;
441
+ readonly sqlite3_value_bytes: (value: SqliteValuePtr) => number;
442
+ readonly sqlite3_value_pointer: (
443
+ value: SqliteValuePtr,
444
+ zPType: CStringPtr,
445
+ ) => WasmPtr | NullPtr;
446
+ readonly sqlite3_value_subtype: (value: SqliteValuePtr) => number;
447
+ readonly sqlite3_value_frombind: (value: SqliteValuePtr) => number;
448
+ readonly sqlite3_value_nochange: (value: SqliteValuePtr) => number;
449
+ readonly sqlite3_value_dup: (
450
+ value: SqliteValuePtr | NullPtr,
451
+ ) => SqliteOwnedValuePtr | NullPtr;
452
+ readonly sqlite3_value_free: (value: SqliteOwnedValuePtr | NullPtr) => void;
453
+ readonly sqlite3_create_function: (
454
+ db: SqliteDbPtr,
455
+ zFunctionName: CStringPtr,
456
+ nArg: number,
457
+ eTextRep: number,
458
+ pApp: WasmPtr | NullPtr,
459
+ xFunc: SqliteFunctionPtr | NullPtr,
460
+ xStep: SqliteFunctionPtr | NullPtr,
461
+ xFinal: SqliteFunctionPtr | NullPtr,
462
+ ) => SqliteResultCode;
463
+ readonly sqlite3_create_function_v2: (
464
+ db: SqliteDbPtr,
465
+ zFunctionName: CStringPtr,
466
+ nArg: number,
467
+ eTextRep: number,
468
+ pApp: WasmPtr | NullPtr,
469
+ xFunc: SqliteFunctionPtr | NullPtr,
470
+ xStep: SqliteFunctionPtr | NullPtr,
471
+ xFinal: SqliteFunctionPtr | NullPtr,
472
+ xDestroy: SqliteFunctionPtr | NullPtr,
473
+ ) => SqliteResultCode;
474
+ readonly sqlite3_overload_function: (
475
+ db: SqliteDbPtr,
476
+ zFuncName: CStringPtr,
477
+ nArg: number,
478
+ ) => SqliteResultCode;
479
+ readonly sqlite3_create_collation: (
480
+ db: SqliteDbPtr,
481
+ zName: CStringPtr,
482
+ eTextRep: number,
483
+ pArg: WasmPtr | NullPtr,
484
+ xCompare: SqliteFunctionPtr | NullPtr,
485
+ ) => SqliteResultCode;
486
+ readonly sqlite3_create_collation_v2: (
487
+ db: SqliteDbPtr,
488
+ zName: CStringPtr,
489
+ eTextRep: number,
490
+ pArg: WasmPtr | NullPtr,
491
+ xCompare: SqliteFunctionPtr | NullPtr,
492
+ xDestroy: SqliteFunctionPtr | NullPtr,
493
+ ) => SqliteResultCode;
494
+ readonly sqlite3_user_data: (context: SqliteContextPtr) => WasmPtr | NullPtr;
495
+ readonly sqlite3_context_db_handle: (
496
+ context: SqliteContextPtr,
497
+ ) => SqliteDbPtr;
498
+ readonly sqlite3_aggregate_context: (
499
+ context: SqliteContextPtr,
500
+ nBytes: number,
501
+ ) => WasmPtr | NullPtr;
502
+ readonly sqlite3_get_auxdata: (
503
+ context: SqliteContextPtr,
504
+ N: number,
505
+ ) => WasmPtr | NullPtr;
506
+ readonly sqlite3_set_auxdata: (
507
+ context: SqliteContextPtr,
508
+ N: number,
509
+ pAux: WasmPtr | NullPtr,
510
+ xDelete: SqliteFunctionPtr | NullPtr,
511
+ ) => void;
512
+ readonly sqlite3_result_null: (context: SqliteContextPtr) => void;
513
+ readonly sqlite3_result_int: (
514
+ context: SqliteContextPtr,
515
+ value: number,
516
+ ) => void;
517
+ readonly sqlite3_result_int64: (
518
+ context: SqliteContextPtr,
519
+ value: bigint,
520
+ ) => void;
521
+ readonly sqlite3_result_double: (
522
+ context: SqliteContextPtr,
523
+ value: number,
524
+ ) => void;
525
+ readonly sqlite3_result_text: (
526
+ context: SqliteContextPtr,
527
+ value: WasmPtr | NullPtr,
528
+ n: number,
529
+ destructor: SqliteDestructor,
530
+ ) => void;
531
+ readonly sqlite3_result_blob: (
532
+ context: SqliteContextPtr,
533
+ value: WasmPtr | NullPtr,
534
+ n: number,
535
+ destructor: SqliteDestructor,
536
+ ) => void;
537
+ readonly sqlite3_result_zeroblob: (
538
+ context: SqliteContextPtr,
539
+ n: number,
540
+ ) => void;
541
+ readonly sqlite3_result_zeroblob64: (
542
+ context: SqliteContextPtr,
543
+ n: bigint,
544
+ ) => SqliteResultCode;
545
+ readonly sqlite3_result_pointer: (
546
+ context: SqliteContextPtr,
547
+ pPtr: WasmPtr | NullPtr,
548
+ zPType: CStringPtr,
549
+ xDestructor: SqliteFunctionPtr | NullPtr,
550
+ ) => void;
551
+ readonly sqlite3_result_subtype: (
552
+ context: SqliteContextPtr,
553
+ subtype: number,
554
+ ) => void;
555
+ readonly sqlite3_result_error: (
556
+ context: SqliteContextPtr,
557
+ message: WasmPtr,
558
+ n: number,
559
+ ) => void;
560
+ readonly sqlite3_result_error_code: (
561
+ context: SqliteContextPtr,
562
+ code: SqliteResultCode,
563
+ ) => void;
564
+ readonly sqlite3_result_error_nomem: (context: SqliteContextPtr) => void;
565
+ readonly sqlite3_result_error_toobig: (context: SqliteContextPtr) => void;
566
+ readonly sqlite3_uri_parameter: (
567
+ z: SqliteFilenamePtr | NullPtr,
568
+ zParam: CStringPtr,
569
+ ) => CStringPtr | NullPtr;
570
+ readonly sqlite3_uri_boolean: (
571
+ z: SqliteFilenamePtr | NullPtr,
572
+ zParam: CStringPtr,
573
+ bDefault: number,
574
+ ) => number;
575
+ readonly sqlite3_uri_int64: (
576
+ z: SqliteFilenamePtr | NullPtr,
577
+ zParam: CStringPtr,
578
+ iDefault: bigint,
579
+ ) => bigint;
580
+ readonly sqlite3_uri_key: (
581
+ z: SqliteFilenamePtr,
582
+ N: number,
583
+ ) => CStringPtr | NullPtr;
584
+ readonly sqlite3_vfs_find: (
585
+ zVfsName: CStringPtr | NullPtr,
586
+ ) => SqliteVfsPtr | NullPtr;
587
+ readonly sqlite3_vfs_register: (
588
+ vfs: SqliteVfsPtr,
589
+ makeDflt: number,
590
+ ) => SqliteResultCode;
591
+ readonly sqlite3_vfs_unregister: (vfs: SqliteVfsPtr) => SqliteResultCode;
592
+ readonly sqlite3_vtab_on_conflict: (db: SqliteDbPtr) => number;
593
+ readonly sqlite3_vtab_nochange: (context: SqliteContextPtr) => number;
594
+ readonly sqlite3_vtab_collation: (
595
+ indexInfo: SqliteIndexInfoPtr,
596
+ iCons: number,
597
+ ) => CStringPtr | NullPtr;
598
+ readonly sqlite3_vtab_distinct: (indexInfo: SqliteIndexInfoPtr) => number;
599
+ readonly sqlite3_vtab_in: (
600
+ indexInfo: SqliteIndexInfoPtr,
601
+ iCons: number,
602
+ bHandle: number,
603
+ ) => number;
604
+ readonly sqlite3_vtab_in_first: (
605
+ pVal: SqliteValuePtr,
606
+ ppOut: WasmPtr,
607
+ ) => SqliteResultCode;
608
+ readonly sqlite3_vtab_in_next: (
609
+ pVal: SqliteValuePtr,
610
+ ppOut: WasmPtr,
611
+ ) => SqliteResultCode;
612
+ readonly sqlite3_vtab_rhs_value: (
613
+ indexInfo: SqliteIndexInfoPtr,
614
+ iCons: number,
615
+ ppVal: WasmPtr,
616
+ ) => SqliteResultCode;
617
+
618
+ /**
619
+ * The build's shim that calls {@link sqlite3_config} with one int for any
620
+ * option, unchecked. sqlite3_config calls it only for the options that take
621
+ * an int.
622
+ *
623
+ * Wasm type `i(ii)`.
624
+ */
625
+ readonly sqlite3__wasm_config_i: (
626
+ op: number,
627
+ value: number,
628
+ ) => SqliteResultCode;
629
+
630
+ /**
631
+ * The build's shim that calls {@link sqlite3_config} with two ints for any
632
+ * option, unchecked. sqlite3_config calls it only for
633
+ * SQLITE_CONFIG_LOOKASIDE.
634
+ *
635
+ * Wasm type `i(iii)`.
636
+ */
637
+ readonly sqlite3__wasm_config_ii: (
638
+ op: number,
639
+ sz: number,
640
+ cnt: number,
641
+ ) => SqliteResultCode;
642
+
643
+ /**
644
+ * The build's shim that calls {@link sqlite3_config} with a 64-bit integer for
645
+ * any option, unchecked. sqlite3_config calls it only for
646
+ * SQLITE_CONFIG_MEMDB_MAXSIZE.
647
+ *
648
+ * Wasm type `i(ij)`.
649
+ */
650
+ readonly sqlite3__wasm_config_j: (
651
+ op: number,
652
+ value: bigint,
653
+ ) => SqliteResultCode;
654
+
655
+ /**
656
+ * The build's shim that calls {@link sqlite3_db_config} with a string for
657
+ * SQLITE_DBCONFIG_MAINDBNAME, and returns SQLITE_MISUSE for any other
658
+ * option.
659
+ *
660
+ * Wasm type `i(iii)`.
661
+ */
662
+ readonly sqlite3__wasm_db_config_s: (
663
+ db: SqliteDbPtr,
664
+ op: number,
665
+ zName: CStringPtr,
666
+ ) => SqliteResultCode;
667
+
668
+ /**
669
+ * The build's shim that calls {@link sqlite3_db_config} with a pointer and two
670
+ * ints for SQLITE_DBCONFIG_LOOKASIDE, and returns SQLITE_MISUSE for any other
671
+ * option.
672
+ *
673
+ * Wasm type `i(iiiii)`.
674
+ */
675
+ readonly sqlite3__wasm_db_config_pii: (
676
+ db: SqliteDbPtr,
677
+ op: number,
678
+ buf: WasmPtr | NullPtr,
679
+ sz: number,
680
+ cnt: number,
681
+ ) => SqliteResultCode;
682
+
683
+ /**
684
+ * The build's shim that calls {@link sqlite3_db_config} with an int and an
685
+ * `int*` for the options that take them, and returns SQLITE_MISUSE for any
686
+ * other option.
687
+ *
688
+ * Wasm type `i(iiii)`.
689
+ */
690
+ readonly sqlite3__wasm_db_config_ip: (
691
+ db: SqliteDbPtr,
692
+ op: number,
693
+ value: number,
694
+ pResult: WasmPtr | NullPtr,
695
+ ) => SqliteResultCode;
696
+
697
+ /**
698
+ * The build's shim that calls {@link sqlite3_vtab_config} with an int for
699
+ * SQLITE_VTAB_CONSTRAINT_SUPPORT and without it for SQLITE_VTAB_INNOCUOUS and
700
+ * SQLITE_VTAB_DIRECTONLY, and returns SQLITE_MISUSE for any other option.
701
+ *
702
+ * Wasm type `i(iii)`.
703
+ */
704
+ readonly sqlite3__wasm_vtab_config: (
705
+ db: SqliteDbPtr,
706
+ op: number,
707
+ value: number,
708
+ ) => SqliteResultCode;
709
+ }
710
+
711
+ /**
712
+ * Initializes the library, returning SQLITE_OK or an error code. Once the
713
+ * library is initialized, further calls are harmless no-ops until
714
+ * {@link sqlite3_shutdown}.
715
+ *
716
+ * Wasm type `i()`. Signature `["sqlite3_initialize", undefined]` from SQLite's
717
+ * table, with the result corrected: SQLite's table declares no result, but the
718
+ * C function returns a result code, as the wasm type shows.
719
+ *
720
+ * See https://sqlite.org/c3ref/initialize.html.
721
+ */
722
+ export const sqlite3_initialize = (
723
+ deps: SqliteWasmDep,
724
+ ): SqliteCExports["sqlite3_initialize"] =>
725
+ deps.sqliteWasm.exports.sqlite3_initialize;
726
+
727
+ /**
728
+ * Deallocates the resources {@link sqlite3_initialize} allocated. Every
729
+ * connection must be closed and every other SQLite resource freed first; only
730
+ * the first call after an initialization has an effect. Then initialize the
731
+ * library again with initializeSqliteWasm. sqlite3_initialize alone, or any
732
+ * call that initializes the library itself, such as an open, makes the unix VFS
733
+ * the default again, from which the generator of {@link sqlite3_randomness},
734
+ * when reset or unused since loading, seeds itself with the time and a constant
735
+ * pid instead of RandomBytes, and registers kvvfs again, which traps when
736
+ * :localStorage: is opened.
737
+ *
738
+ * Wasm type `i()`. Signature `["sqlite3_shutdown", undefined]` from SQLite's
739
+ * table, with the result corrected: SQLite's table declares no result, but the
740
+ * C function returns a result code, as the wasm type shows.
741
+ *
742
+ * See https://sqlite.org/c3ref/initialize.html.
743
+ */
744
+ export const sqlite3_shutdown = (
745
+ deps: SqliteWasmDep,
746
+ ): SqliteCExports["sqlite3_shutdown"] =>
747
+ deps.sqliteWasm.exports.sqlite3_shutdown;
748
+
749
+ /**
750
+ * Returns the library's version string, the SQLITE_VERSION it was built with,
751
+ * in static memory.
752
+ *
753
+ * Wasm type `i()`. Signature `["sqlite3_libversion", "string"]` from SQLite's
754
+ * table.
755
+ *
756
+ * See https://sqlite.org/c3ref/libversion.html.
757
+ */
758
+ export const sqlite3_libversion = (
759
+ deps: SqliteWasmDep,
760
+ ): SqliteCExports["sqlite3_libversion"] =>
761
+ deps.sqliteWasm.exports.sqlite3_libversion;
762
+
763
+ /**
764
+ * Returns the SQLITE_VERSION_NUMBER the library was built with.
765
+ *
766
+ * Wasm type `i()`. Signature `["sqlite3_libversion_number", "int"]` from
767
+ * SQLite's table.
768
+ *
769
+ * See https://sqlite.org/c3ref/libversion.html.
770
+ */
771
+ export const sqlite3_libversion_number = (
772
+ deps: SqliteWasmDep,
773
+ ): SqliteCExports["sqlite3_libversion_number"] =>
774
+ deps.sqliteWasm.exports.sqlite3_libversion_number;
775
+
776
+ /**
777
+ * Returns the date, time and check-in hash of the SQLite source the library was
778
+ * built from, as a static string.
779
+ *
780
+ * Wasm type `i()`. Signature `["sqlite3_sourceid", "string"]` from SQLite's
781
+ * table.
782
+ *
783
+ * See https://sqlite.org/c3ref/libversion.html.
784
+ */
785
+ export const sqlite3_sourceid = (
786
+ deps: SqliteWasmDep,
787
+ ): SqliteCExports["sqlite3_sourceid"] =>
788
+ deps.sqliteWasm.exports.sqlite3_sourceid;
789
+
790
+ /**
791
+ * Returns the N-th option defined at compile time, without its SQLITE_ prefix,
792
+ * or NULL when N is out of range. The string is static.
793
+ *
794
+ * Wasm type `i(i)`. Signature `["sqlite3_compileoption_get", "string", "int"]`
795
+ * from SQLite's table.
796
+ *
797
+ * See https://sqlite.org/c3ref/compileoption_get.html.
798
+ */
799
+ export const sqlite3_compileoption_get = (
800
+ deps: SqliteWasmDep,
801
+ ): SqliteCExports["sqlite3_compileoption_get"] =>
802
+ deps.sqliteWasm.exports.sqlite3_compileoption_get;
803
+
804
+ /**
805
+ * Returns 1 if the named option, with or without its SQLITE_ prefix, was
806
+ * defined at compile time, and 0 otherwise.
807
+ *
808
+ * Wasm type `i(i)`. Signature `["sqlite3_compileoption_used", "int", "string"]`
809
+ * from SQLite's table.
810
+ *
811
+ * See https://sqlite.org/c3ref/compileoption_get.html.
812
+ */
813
+ export const sqlite3_compileoption_used = (
814
+ deps: SqliteWasmDep,
815
+ ): SqliteCExports["sqlite3_compileoption_used"] =>
816
+ deps.sqliteWasm.exports.sqlite3_compileoption_used;
817
+
818
+ /**
819
+ * Reads a global SQLITE_STATUS_* counter into `*pCurrent` and its highwater
820
+ * mark into `*pHighwater`, resetting the mark when resetFlag is non-zero. A
821
+ * counter that tracks only one of the two leaves the other unwritten, and
822
+ * values beyond 32 bits are undefined.
823
+ *
824
+ * Wasm type `i(iiii)`. Signature `["sqlite3_status", "int", "int", "*", "*",
825
+ * "int"]` from SQLite's table.
826
+ *
827
+ * See https://sqlite.org/c3ref/status.html.
828
+ */
829
+ export const sqlite3_status = (
830
+ deps: SqliteWasmDep,
831
+ ): SqliteCExports["sqlite3_status"] => deps.sqliteWasm.exports.sqlite3_status;
832
+
833
+ /**
834
+ * Reads a global SQLITE_STATUS_* counter into the sqlite3_int64 at pCurrent and
835
+ * its highwater mark into the sqlite3_int64 at pHighwater, 8 bytes each,
836
+ * resetting the mark when resetFlag is non-zero. Some counters leave one of the
837
+ * two outputs unwritten.
838
+ *
839
+ * Wasm type `i(iiii)`. Signature `["sqlite3_status64", "int", "int", "*", "*",
840
+ * "int"]` from SQLite's table.
841
+ *
842
+ * See https://sqlite.org/c3ref/status.html.
843
+ */
844
+ export const sqlite3_status64 = (
845
+ deps: SqliteWasmDep,
846
+ ): SqliteCExports["sqlite3_status64"] =>
847
+ deps.sqliteWasm.exports.sqlite3_status64;
848
+
849
+ /**
850
+ * Registers an entry point that SQLite calls for every new connection, where an
851
+ * error it returns fails the open; registering one twice is a no-op. Despite
852
+ * the `void (*)(void)` prototype SQLite calls it as `int xEntryPoint(sqlite3
853
+ * *db, char **pzErrMsg, const sqlite3_api_routines *pThunk)`, so its function
854
+ * table entry must have that type.
855
+ *
856
+ * Wasm type `i(i)`. Signature `["sqlite3_auto_extension", "int",
857
+ * "funcptr:i(ppp)"]` from Evolu's supplement: SQLite binds the auto-extension
858
+ * functions by hand to manage the JavaScript functions it converts.
859
+ *
860
+ * See https://sqlite.org/c3ref/auto_extension.html.
861
+ */
862
+ export const sqlite3_auto_extension = (
863
+ deps: SqliteWasmDep,
864
+ ): SqliteCExports["sqlite3_auto_extension"] =>
865
+ deps.sqliteWasm.exports.sqlite3_auto_extension;
866
+
867
+ /**
868
+ * Unregisters an entry point {@link sqlite3_auto_extension} registered,
869
+ * returning 1 when it was registered and 0 otherwise.
870
+ *
871
+ * Wasm type `i(i)`. Signature `["sqlite3_cancel_auto_extension", "int",
872
+ * "funcptr:i(ppp)"]` from Evolu's supplement: SQLite binds the auto-extension
873
+ * functions by hand to manage the JavaScript functions it converts.
874
+ *
875
+ * See https://sqlite.org/c3ref/cancel_auto_extension.html.
876
+ */
877
+ export const sqlite3_cancel_auto_extension = (
878
+ deps: SqliteWasmDep,
879
+ ): SqliteCExports["sqlite3_cancel_auto_extension"] =>
880
+ deps.sqliteWasm.exports.sqlite3_cancel_auto_extension;
881
+
882
+ /**
883
+ * Unregisters every entry point {@link sqlite3_auto_extension} registered.
884
+ *
885
+ * Wasm type `v()`. Signature `["sqlite3_reset_auto_extension", undefined]` from
886
+ * Evolu's supplement: SQLite binds the auto-extension functions by hand to
887
+ * manage the JavaScript functions it converts.
888
+ *
889
+ * See https://sqlite.org/c3ref/reset_auto_extension.html.
890
+ */
891
+ export const sqlite3_reset_auto_extension = (
892
+ deps: SqliteWasmDep,
893
+ ): SqliteCExports["sqlite3_reset_auto_extension"] =>
894
+ deps.sqliteWasm.exports.sqlite3_reset_auto_extension;
895
+
896
+ /**
897
+ * Writes N pseudo-random bytes to P. A call with N below 1 or a NULL P writes
898
+ * nothing and makes the next call reseed from the default VFS's xRandomness.
899
+ *
900
+ * Wasm type `v(ii)`. Signature `["sqlite3_randomness", undefined, "int", "*"]`
901
+ * from Evolu's supplement: SQLite binds it by hand to fill typed arrays.
902
+ *
903
+ * See https://sqlite.org/c3ref/randomness.html.
904
+ */
905
+ export const sqlite3_randomness = (
906
+ deps: SqliteWasmDep,
907
+ ): SqliteCExports["sqlite3_randomness"] =>
908
+ deps.sqliteWasm.exports.sqlite3_randomness;
909
+
910
+ /**
911
+ * Returns 1 when UTF-8 SQL text ends with a complete statement, a final
912
+ * semicolon token that does not end inside a CREATE TRIGGER body, and 0
913
+ * otherwise. It tokenizes without parsing, so it does not detect invalid SQL.
914
+ *
915
+ * Wasm type `i(i)`. Signature `["sqlite3_complete", "int", "string:flexible"]`
916
+ * from SQLite's table.
917
+ *
918
+ * See https://sqlite.org/c3ref/complete.html.
919
+ */
920
+ export const sqlite3_complete = (
921
+ deps: SqliteWasmDep,
922
+ ): SqliteCExports["sqlite3_complete"] =>
923
+ deps.sqliteWasm.exports.sqlite3_complete;
924
+
925
+ /**
926
+ * Returns the number of distinct SQL keywords the library recognizes, which
927
+ * depends on compile-time options.
928
+ *
929
+ * Wasm type `i()`. Signature `["sqlite3_keyword_count", "int"]` from SQLite's
930
+ * table.
931
+ *
932
+ * See https://sqlite.org/c3ref/keyword_check.html.
933
+ */
934
+ export const sqlite3_keyword_count = (
935
+ deps: SqliteWasmDep,
936
+ ): SqliteCExports["sqlite3_keyword_count"] =>
937
+ deps.sqliteWasm.exports.sqlite3_keyword_count;
938
+
939
+ /**
940
+ * Writes the address and byte length of the 0-based index-th SQL keyword, UTF-8
941
+ * without a NUL terminator in static memory, and returns SQLITE_ERROR when the
942
+ * index is out of range. Both output pointers must be valid.
943
+ *
944
+ * Wasm type `i(iii)`. Signature `["sqlite3_keyword_name", "int", "int", "**",
945
+ * "*"]` from SQLite's table.
946
+ *
947
+ * See https://sqlite.org/c3ref/keyword_check.html.
948
+ */
949
+ export const sqlite3_keyword_name = (
950
+ deps: SqliteWasmDep,
951
+ ): SqliteCExports["sqlite3_keyword_name"] =>
952
+ deps.sqliteWasm.exports.sqlite3_keyword_name;
953
+
954
+ /**
955
+ * Returns non-zero if the nName bytes of UTF-8 at zName, which need no NUL
956
+ * terminator, are an SQL keyword in any letter case, and 0 otherwise.
957
+ *
958
+ * Wasm type `i(ii)`. Signature `["sqlite3_keyword_check", "int", "string",
959
+ * "int"]` from SQLite's table.
960
+ *
961
+ * See https://sqlite.org/c3ref/keyword_check.html.
962
+ */
963
+ export const sqlite3_keyword_check = (
964
+ deps: SqliteWasmDep,
965
+ ): SqliteCExports["sqlite3_keyword_check"] =>
966
+ deps.sqliteWasm.exports.sqlite3_keyword_check;
967
+
968
+ /**
969
+ * Returns 0 when zStr matches the GLOB pattern zGlob, case-sensitively as SQL's
970
+ * GLOB operator does, and non-zero otherwise.
971
+ *
972
+ * Wasm type `i(ii)`. Signature `["sqlite3_strglob", "int", "string", "string"]`
973
+ * from SQLite's table.
974
+ *
975
+ * See https://sqlite.org/c3ref/strglob.html.
976
+ */
977
+ export const sqlite3_strglob = (
978
+ deps: SqliteWasmDep,
979
+ ): SqliteCExports["sqlite3_strglob"] => deps.sqliteWasm.exports.sqlite3_strglob;
980
+
981
+ /**
982
+ * Returns 0 when zStr matches the LIKE pattern zGlob with escape character
983
+ * cEsc, or none for 0, and non-zero otherwise. Like SQL's LIKE operator, it
984
+ * folds only ASCII case.
985
+ *
986
+ * Wasm type `i(iii)`. Signature `["sqlite3_strlike", "int", "string", "string",
987
+ * "int"]` from SQLite's table.
988
+ *
989
+ * See https://sqlite.org/c3ref/strlike.html.
990
+ */
991
+ export const sqlite3_strlike = (
992
+ deps: SqliteWasmDep,
993
+ ): SqliteCExports["sqlite3_strlike"] => deps.sqliteWasm.exports.sqlite3_strlike;
994
+
995
+ /**
996
+ * Compares two UTF-8 strings, folding only ASCII case as SQLite does for
997
+ * identifiers, and returns 0 when they are equal or a negative or positive
998
+ * number that orders them.
999
+ *
1000
+ * Wasm type `i(ii)`. Signature `["sqlite3_stricmp", "int", "string", "string"]`
1001
+ * from SQLite's table.
1002
+ *
1003
+ * See https://sqlite.org/c3ref/stricmp.html.
1004
+ */
1005
+ export const sqlite3_stricmp = (
1006
+ deps: SqliteWasmDep,
1007
+ ): SqliteCExports["sqlite3_stricmp"] => deps.sqliteWasm.exports.sqlite3_stricmp;
1008
+
1009
+ /**
1010
+ * Compares at most N bytes of two UTF-8 strings, folding only ASCII case as
1011
+ * SQLite does for identifiers, and returns 0 when they are equal or a negative
1012
+ * or positive number that orders them.
1013
+ *
1014
+ * Wasm type `i(iii)`. Signature `["sqlite3_strnicmp", "int", "string",
1015
+ * "string", "int"]` from SQLite's table.
1016
+ *
1017
+ * See https://sqlite.org/c3ref/stricmp.html.
1018
+ */
1019
+ export const sqlite3_strnicmp = (
1020
+ deps: SqliteWasmDep,
1021
+ ): SqliteCExports["sqlite3_strnicmp"] =>
1022
+ deps.sqliteWasm.exports.sqlite3_strnicmp;
1023
+
1024
+ /**
1025
+ * Allocates at least byteLength bytes, returning NULL when out of memory or
1026
+ * when byteLength is zero or negative.
1027
+ *
1028
+ * Wasm type `i(i)`. Signature `["sqlite3_malloc", "*", "int"]` from SQLite's
1029
+ * table.
1030
+ *
1031
+ * See https://sqlite.org/c3ref/free.html.
1032
+ */
1033
+ export const sqlite3_malloc = (
1034
+ deps: SqliteWasmDep,
1035
+ ): SqliteCExports["sqlite3_malloc"] => deps.sqliteWasm.exports.sqlite3_malloc;
1036
+
1037
+ /**
1038
+ * Allocates memory like {@link sqlite3_malloc} with a 64-bit size, returning
1039
+ * NULL when out of memory or for zero bytes.
1040
+ *
1041
+ * Wasm type `i(j)`. Signature `["sqlite3_malloc64", "*", "i64"]` from SQLite's
1042
+ * table.
1043
+ *
1044
+ * See https://sqlite.org/c3ref/free.html.
1045
+ */
1046
+ export const sqlite3_malloc64 = (
1047
+ deps: SqliteWasmDep,
1048
+ ): SqliteCExports["sqlite3_malloc64"] =>
1049
+ deps.sqliteWasm.exports.sqlite3_malloc64;
1050
+
1051
+ /**
1052
+ * Resizes memory from {@link sqlite3_malloc}, keeping its leading bytes, and
1053
+ * returns the new address, after which the old one is invalid. A NULL pointer
1054
+ * allocates, a size of 0 or less frees and returns NULL, and when out of memory
1055
+ * it returns NULL and leaves the old allocation intact.
1056
+ *
1057
+ * Wasm type `i(ii)`. Signature `["sqlite3_realloc", "*", "*", "int"]` from
1058
+ * SQLite's table.
1059
+ *
1060
+ * See https://sqlite.org/c3ref/free.html.
1061
+ */
1062
+ export const sqlite3_realloc = (
1063
+ deps: SqliteWasmDep,
1064
+ ): SqliteCExports["sqlite3_realloc"] => deps.sqliteWasm.exports.sqlite3_realloc;
1065
+
1066
+ /**
1067
+ * Resizes memory from {@link sqlite3_malloc}, moving its contents to the
1068
+ * returned address; NULL memory allocates, and a zero size frees it and returns
1069
+ * NULL. When out of memory it returns NULL and leaves the old memory
1070
+ * allocated.
1071
+ *
1072
+ * Wasm type `i(ij)`. Signature `["sqlite3_realloc64", "*", "*", "i64"]` from
1073
+ * SQLite's table.
1074
+ *
1075
+ * See https://sqlite.org/c3ref/free.html.
1076
+ */
1077
+ export const sqlite3_realloc64 = (
1078
+ deps: SqliteWasmDep,
1079
+ ): SqliteCExports["sqlite3_realloc64"] =>
1080
+ deps.sqliteWasm.exports.sqlite3_realloc64;
1081
+
1082
+ /**
1083
+ * Returns the usable byte size of memory from {@link sqlite3_malloc},
1084
+ * {@link sqlite3_realloc} or their 64-bit variants, which can exceed the
1085
+ * requested size, or 0 for NULL.
1086
+ *
1087
+ * Wasm type `j(i)`. Signature `["sqlite3_msize", "i64", "*"]` from SQLite's
1088
+ * table.
1089
+ *
1090
+ * See https://sqlite.org/c3ref/free.html.
1091
+ */
1092
+ export const sqlite3_msize = (
1093
+ deps: SqliteWasmDep,
1094
+ ): SqliteCExports["sqlite3_msize"] => deps.sqliteWasm.exports.sqlite3_msize;
1095
+
1096
+ /**
1097
+ * Frees memory from {@link sqlite3_malloc} or from a SQLite function that
1098
+ * returns owned memory.
1099
+ *
1100
+ * Wasm type `v(i)`. Signature `["sqlite3_free", undefined, "*"]` from SQLite's
1101
+ * table.
1102
+ *
1103
+ * See https://sqlite.org/c3ref/free.html.
1104
+ */
1105
+ export const sqlite3_free = (
1106
+ deps: SqliteWasmDep,
1107
+ ): SqliteCExports["sqlite3_free"] => deps.sqliteWasm.exports.sqlite3_free;
1108
+
1109
+ /**
1110
+ * Opens a database connection for reading and writing, creating the database
1111
+ * when it does not exist, with the default VFS. SQLite writes a handle even
1112
+ * when opening fails, except when out of memory, and that handle must be
1113
+ * closed.
1114
+ *
1115
+ * Wasm type `i(ii)`. Signature `["sqlite3_open", "int", "string", "*"]` from
1116
+ * SQLite's table.
1117
+ *
1118
+ * See https://sqlite.org/c3ref/open.html.
1119
+ */
1120
+ export const sqlite3_open = (
1121
+ deps: SqliteWasmDep,
1122
+ ): SqliteCExports["sqlite3_open"] => deps.sqliteWasm.exports.sqlite3_open;
1123
+
1124
+ /**
1125
+ * Opens a database connection. SQLite writes a handle even when opening fails,
1126
+ * except when out of memory, and that handle must be closed.
1127
+ *
1128
+ * Wasm type `i(iiii)`. Signature `["sqlite3_open_v2", "int", "string", "*",
1129
+ * "int", "string"]` from SQLite's table.
1130
+ *
1131
+ * See https://sqlite.org/c3ref/open.html.
1132
+ */
1133
+ export const sqlite3_open_v2 = (
1134
+ deps: SqliteWasmDep,
1135
+ ): SqliteCExports["sqlite3_open_v2"] => deps.sqliteWasm.exports.sqlite3_open_v2;
1136
+
1137
+ /**
1138
+ * Closes a connection. With unfinalized statements the close is deferred and
1139
+ * the connection keeps its files open.
1140
+ *
1141
+ * Wasm type `i(i)`. Signature `["sqlite3_close_v2", "int", "sqlite3*"]` from
1142
+ * Evolu's supplement: SQLite binds it by hand to release JavaScript callbacks
1143
+ * first.
1144
+ *
1145
+ * See https://sqlite.org/c3ref/close.html.
1146
+ */
1147
+ export const sqlite3_close_v2 = (
1148
+ deps: SqliteWasmDep,
1149
+ ): SqliteCExports["sqlite3_close_v2"] =>
1150
+ deps.sqliteWasm.exports.sqlite3_close_v2;
1151
+
1152
+ /**
1153
+ * Returns the absolute filename of a schema of the connection, valid until the
1154
+ * schema is detached or the connection closes, or NULL or an empty string for a
1155
+ * temporary or in-memory database or an unknown schema. A non-NULL result can
1156
+ * be passed to the `sqlite3_uri_*` functions.
1157
+ *
1158
+ * Wasm type `i(ii)`. Signature `["sqlite3_db_filename", "string", "sqlite3*",
1159
+ * "string"]` from SQLite's table.
1160
+ *
1161
+ * See https://sqlite.org/c3ref/db_filename.html.
1162
+ */
1163
+ export const sqlite3_db_filename = (
1164
+ deps: SqliteWasmDep,
1165
+ ): SqliteCExports["sqlite3_db_filename"] =>
1166
+ deps.sqliteWasm.exports.sqlite3_db_filename;
1167
+
1168
+ /**
1169
+ * Returns the schema name of the connection's N-th database, where 0 is main
1170
+ * and 1 is temp, or NULL when N is out of range. SQLite owns the string, which
1171
+ * any schema change, such as ATTACH, DETACH, {@link sqlite3_serialize} or
1172
+ * {@link sqlite3_deserialize}, can free.
1173
+ *
1174
+ * Wasm type `i(ii)`. Signature `["sqlite3_db_name", "string", "sqlite3*",
1175
+ * "int"]` from SQLite's table.
1176
+ *
1177
+ * See https://sqlite.org/c3ref/db_name.html.
1178
+ */
1179
+ export const sqlite3_db_name = (
1180
+ deps: SqliteWasmDep,
1181
+ ): SqliteCExports["sqlite3_db_name"] => deps.sqliteWasm.exports.sqlite3_db_name;
1182
+
1183
+ /**
1184
+ * Returns 1 if a schema of the connection is read-only, 0 if it is read/write,
1185
+ * or -1 when no schema has that name.
1186
+ *
1187
+ * Wasm type `i(ii)`. Signature `["sqlite3_db_readonly", "int", "sqlite3*",
1188
+ * "string"]` from SQLite's table.
1189
+ *
1190
+ * See https://sqlite.org/c3ref/db_readonly.html.
1191
+ */
1192
+ export const sqlite3_db_readonly = (
1193
+ deps: SqliteWasmDep,
1194
+ ): SqliteCExports["sqlite3_db_readonly"] =>
1195
+ deps.sqliteWasm.exports.sqlite3_db_readonly;
1196
+
1197
+ /**
1198
+ * Returns a schema's transaction state, SQLITE_TXN_NONE, SQLITE_TXN_READ or
1199
+ * SQLITE_TXN_WRITE, the highest across all schemas for NULL, or -1 for an
1200
+ * unknown schema.
1201
+ *
1202
+ * Wasm type `i(ii)`. Signature `["sqlite3_txn_state", "int", "sqlite3*",
1203
+ * "string"]` from SQLite's table.
1204
+ *
1205
+ * See https://sqlite.org/c3ref/txn_state.html.
1206
+ */
1207
+ export const sqlite3_txn_state = (
1208
+ deps: SqliteWasmDep,
1209
+ ): SqliteCExports["sqlite3_txn_state"] =>
1210
+ deps.sqliteWasm.exports.sqlite3_txn_state;
1211
+
1212
+ /**
1213
+ * Returns 0 from BEGIN until the COMMIT or ROLLBACK that ends the transaction,
1214
+ * and non-zero otherwise. It is the only way to tell whether SQLite rolled back
1215
+ * a transaction automatically after an error such as SQLITE_FULL or
1216
+ * SQLITE_BUSY.
1217
+ *
1218
+ * Wasm type `i(i)`. Signature `["sqlite3_get_autocommit", "int", "sqlite3*"]`
1219
+ * from SQLite's table.
1220
+ *
1221
+ * See https://sqlite.org/c3ref/get_autocommit.html.
1222
+ */
1223
+ export const sqlite3_get_autocommit = (
1224
+ deps: SqliteWasmDep,
1225
+ ): SqliteCExports["sqlite3_get_autocommit"] =>
1226
+ deps.sqliteWasm.exports.sqlite3_get_autocommit;
1227
+
1228
+ /**
1229
+ * Sets a run-time limit of the connection and returns its prior value; a
1230
+ * negative newVal only reads it, and a value above the compile-time maximum is
1231
+ * lowered to that maximum.
1232
+ *
1233
+ * Wasm type `i(iii)`. Signature `["sqlite3_limit", "int", "sqlite3*", "int",
1234
+ * "int"]` from SQLite's table.
1235
+ *
1236
+ * See https://sqlite.org/c3ref/limit.html.
1237
+ */
1238
+ export const sqlite3_limit = (
1239
+ deps: SqliteWasmDep,
1240
+ ): SqliteCExports["sqlite3_limit"] => deps.sqliteWasm.exports.sqlite3_limit;
1241
+
1242
+ /**
1243
+ * Sets the connection's only busy handler, replacing any other, including the
1244
+ * one {@link sqlite3_busy_timeout} sets, or removes it for NULL so a lock fails
1245
+ * with SQLITE_BUSY at once. SQLite calls it with pArg and the number of earlier
1246
+ * calls for the same lock and retries while it returns non-zero; it must not
1247
+ * modify the connection.
1248
+ *
1249
+ * Wasm type `i(iii)`. Signature `["sqlite3_busy_handler", "int", "sqlite3*",
1250
+ * "funcptr:i(pi)", "*"]` from SQLite's table.
1251
+ *
1252
+ * See https://sqlite.org/c3ref/busy_handler.html.
1253
+ */
1254
+ export const sqlite3_busy_handler = (
1255
+ deps: SqliteWasmDep,
1256
+ ): SqliteCExports["sqlite3_busy_handler"] =>
1257
+ deps.sqliteWasm.exports.sqlite3_busy_handler;
1258
+
1259
+ /**
1260
+ * Sets a busy handler that sleeps and retries until at least ms milliseconds
1261
+ * have passed, replacing any other busy handler; ms of zero or less removes all
1262
+ * busy handlers.
1263
+ *
1264
+ * Wasm type `i(ii)`. Signature `["sqlite3_busy_timeout", "int", "sqlite3*",
1265
+ * "int"]` from SQLite's table.
1266
+ *
1267
+ * See https://sqlite.org/c3ref/busy_timeout.html.
1268
+ */
1269
+ export const sqlite3_busy_timeout = (
1270
+ deps: SqliteWasmDep,
1271
+ ): SqliteCExports["sqlite3_busy_timeout"] =>
1272
+ deps.sqliteWasm.exports.sqlite3_busy_timeout;
1273
+
1274
+ /**
1275
+ * Stops the connection's running statements, and statements started before they
1276
+ * all finish, at their earliest opportunity with SQLITE_INTERRUPT; an
1277
+ * interrupted write in an explicit transaction rolls the transaction back. With
1278
+ * no running statement it does nothing.
1279
+ *
1280
+ * Wasm type `v(i)`. Signature `["sqlite3_interrupt", undefined, "sqlite3*"]`
1281
+ * from SQLite's table.
1282
+ *
1283
+ * See https://sqlite.org/c3ref/interrupt.html.
1284
+ */
1285
+ export const sqlite3_interrupt = (
1286
+ deps: SqliteWasmDep,
1287
+ ): SqliteCExports["sqlite3_interrupt"] =>
1288
+ deps.sqliteWasm.exports.sqlite3_interrupt;
1289
+
1290
+ /**
1291
+ * Returns 1 while an {@link sqlite3_interrupt} is in effect for the connection,
1292
+ * and 0 otherwise.
1293
+ *
1294
+ * Wasm type `i(i)`. Signature `["sqlite3_is_interrupted", "int", "sqlite3*"]`
1295
+ * from SQLite's table.
1296
+ *
1297
+ * See https://sqlite.org/c3ref/interrupt.html.
1298
+ */
1299
+ export const sqlite3_is_interrupted = (
1300
+ deps: SqliteWasmDep,
1301
+ ): SqliteCExports["sqlite3_is_interrupted"] =>
1302
+ deps.sqliteWasm.exports.sqlite3_is_interrupted;
1303
+
1304
+ /**
1305
+ * Enables extended result codes for the connection when onoff is non-zero and
1306
+ * disables them otherwise. They are disabled by default, and
1307
+ * {@link sqlite3_extended_errcode} returns them regardless.
1308
+ *
1309
+ * Wasm type `i(ii)`. Signature `["sqlite3_extended_result_codes", "int",
1310
+ * "sqlite3*", "int"]` from SQLite's table.
1311
+ *
1312
+ * See https://sqlite.org/c3ref/extended_result_codes.html.
1313
+ */
1314
+ export const sqlite3_extended_result_codes = (
1315
+ deps: SqliteWasmDep,
1316
+ ): SqliteCExports["sqlite3_extended_result_codes"] =>
1317
+ deps.sqliteWasm.exports.sqlite3_extended_result_codes;
1318
+
1319
+ /**
1320
+ * Calls the xFileControl method of a schema's file, main for a NULL zDbName,
1321
+ * with an opcode and its argument and returns its result; the core handles a
1322
+ * few opcodes, such as SQLITE_FCNTL_FILE_POINTER, itself. An unknown schema
1323
+ * returns SQLITE_ERROR without recording it for {@link sqlite3_errcode}.
1324
+ *
1325
+ * Wasm type `i(iiii)`. Signature `["sqlite3_file_control", "int", "sqlite3*",
1326
+ * "string", "int", "*"]` from SQLite's table.
1327
+ *
1328
+ * See https://sqlite.org/c3ref/file_control.html.
1329
+ */
1330
+ export const sqlite3_file_control = (
1331
+ deps: SqliteWasmDep,
1332
+ ): SqliteCExports["sqlite3_file_control"] =>
1333
+ deps.sqliteWasm.exports.sqlite3_file_control;
1334
+
1335
+ /**
1336
+ * Writes a table column's declared type, collation sequence and NOT NULL,
1337
+ * PRIMARY KEY and AUTOINCREMENT flags through the non-NULL output pointers,
1338
+ * failing for a missing column or a view; a NULL column name only checks that
1339
+ * the table exists. The returned strings stay valid only until the next SQLite
1340
+ * call.
1341
+ *
1342
+ * Wasm type `i(iiiiiiiii)`. Signature `["sqlite3_table_column_metadata", "int",
1343
+ * "sqlite3*", "string", "string", "string", "**", "**", "*", "*", "*"]` from
1344
+ * SQLite's table.
1345
+ *
1346
+ * See https://sqlite.org/c3ref/table_column_metadata.html.
1347
+ */
1348
+ export const sqlite3_table_column_metadata = (
1349
+ deps: SqliteWasmDep,
1350
+ ): SqliteCExports["sqlite3_table_column_metadata"] =>
1351
+ deps.sqliteWasm.exports.sqlite3_table_column_metadata;
1352
+
1353
+ /**
1354
+ * Writes the current and highest values of a connection status counter to pCur
1355
+ * and pHiwtr, resetting the highest to the current value when resetFlg is
1356
+ * non-zero. Values above the int range are truncated;
1357
+ * {@link sqlite3_db_status64} returns them in full.
1358
+ *
1359
+ * Wasm type `i(iiiii)`. Signature `["sqlite3_db_status", "int", "sqlite3*",
1360
+ * "int", "*", "*", "int"]` from SQLite's table.
1361
+ *
1362
+ * See https://sqlite.org/c3ref/db_status.html.
1363
+ */
1364
+ export const sqlite3_db_status = (
1365
+ deps: SqliteWasmDep,
1366
+ ): SqliteCExports["sqlite3_db_status"] =>
1367
+ deps.sqliteWasm.exports.sqlite3_db_status;
1368
+
1369
+ /**
1370
+ * Reads a connection's SQLITE_DBSTATUS_* counter into the sqlite3_int64 at pCur
1371
+ * and its highwater mark into the sqlite3_int64 at pHiwtr, 8 bytes each,
1372
+ * resetting the mark to the current value when resetFlg is non-zero.
1373
+ *
1374
+ * Wasm type `i(iiiii)`. Signature `["sqlite3_db_status64", "int", "sqlite3*",
1375
+ * "int", "*", "*", "int"]` from SQLite's table.
1376
+ *
1377
+ * See https://sqlite.org/c3ref/db_status.html.
1378
+ */
1379
+ export const sqlite3_db_status64 = (
1380
+ deps: SqliteWasmDep,
1381
+ ): SqliteCExports["sqlite3_db_status64"] =>
1382
+ deps.sqliteWasm.exports.sqlite3_db_status64;
1383
+
1384
+ /**
1385
+ * Returns the rowid of the connection's most recent successful INSERT into a
1386
+ * rowid table, or 0 if there was none. Inside a trigger it returns the
1387
+ * trigger's insert until the trigger ends, and a failed INSERT leaves it
1388
+ * unchanged.
1389
+ *
1390
+ * Wasm type `j(i)`. Signature `["sqlite3_last_insert_rowid", "i64",
1391
+ * "sqlite3*"]` from SQLite's table.
1392
+ *
1393
+ * See https://sqlite.org/c3ref/last_insert_rowid.html.
1394
+ */
1395
+ export const sqlite3_last_insert_rowid = (
1396
+ deps: SqliteWasmDep,
1397
+ ): SqliteCExports["sqlite3_last_insert_rowid"] =>
1398
+ deps.sqliteWasm.exports.sqlite3_last_insert_rowid;
1399
+
1400
+ /**
1401
+ * Sets the value {@link sqlite3_last_insert_rowid} returns for the connection
1402
+ * without inserting a row.
1403
+ *
1404
+ * Wasm type `v(ij)`. Signature `["sqlite3_set_last_insert_rowid", undefined,
1405
+ * "sqlite3*", "i64"]` from SQLite's table.
1406
+ *
1407
+ * See https://sqlite.org/c3ref/set_last_insert_rowid.html.
1408
+ */
1409
+ export const sqlite3_set_last_insert_rowid = (
1410
+ deps: SqliteWasmDep,
1411
+ ): SqliteCExports["sqlite3_set_last_insert_rowid"] =>
1412
+ deps.sqliteWasm.exports.sqlite3_set_last_insert_rowid;
1413
+
1414
+ /**
1415
+ * Returns the rows changed by the connection's most recently completed INSERT,
1416
+ * UPDATE or DELETE, without changes by triggers, foreign key actions or
1417
+ * REPLACE; other statements leave it unchanged, except a DROP TABLE that, with
1418
+ * foreign keys on, first deletes the rows of a table that foreign keys
1419
+ * reference. The result is undefined above the int range, which
1420
+ * {@link sqlite3_changes64} covers.
1421
+ *
1422
+ * Wasm type `i(i)`. Signature `["sqlite3_changes", "int", "sqlite3*"]` from
1423
+ * SQLite's table.
1424
+ *
1425
+ * See https://sqlite.org/c3ref/changes.html.
1426
+ */
1427
+ export const sqlite3_changes = (
1428
+ deps: SqliteWasmDep,
1429
+ ): SqliteCExports["sqlite3_changes"] => deps.sqliteWasm.exports.sqlite3_changes;
1430
+
1431
+ /**
1432
+ * Returns the rows changed by the connection's most recently completed INSERT,
1433
+ * UPDATE or DELETE, without changes by triggers, foreign key actions or
1434
+ * REPLACE; other statements leave it unchanged, except a DROP TABLE that, with
1435
+ * foreign keys on, first deletes the rows of a table that foreign keys
1436
+ * reference.
1437
+ *
1438
+ * Wasm type `j(i)`. Signature `["sqlite3_changes64", "i64", "sqlite3*"]` from
1439
+ * SQLite's table.
1440
+ *
1441
+ * See https://sqlite.org/c3ref/changes.html.
1442
+ */
1443
+ export const sqlite3_changes64 = (
1444
+ deps: SqliteWasmDep,
1445
+ ): SqliteCExports["sqlite3_changes64"] =>
1446
+ deps.sqliteWasm.exports.sqlite3_changes64;
1447
+
1448
+ /**
1449
+ * Returns the rows inserted, updated or deleted by the connection's completed
1450
+ * statements since it opened, including those of triggers and foreign key
1451
+ * actions. The result is undefined beyond the int range, which
1452
+ * {@link sqlite3_total_changes64} avoids.
1453
+ *
1454
+ * Wasm type `i(i)`. Signature `["sqlite3_total_changes", "int", "sqlite3*"]`
1455
+ * from SQLite's table.
1456
+ *
1457
+ * See https://sqlite.org/c3ref/total_changes.html.
1458
+ */
1459
+ export const sqlite3_total_changes = (
1460
+ deps: SqliteWasmDep,
1461
+ ): SqliteCExports["sqlite3_total_changes"] =>
1462
+ deps.sqliteWasm.exports.sqlite3_total_changes;
1463
+
1464
+ /**
1465
+ * Returns the number of rows changed by INSERT, UPDATE and DELETE statements on
1466
+ * the connection since it opened, counting trigger and foreign key action
1467
+ * changes but not REPLACE conflict deletions. Other connections do not change
1468
+ * it, and other statements do not either, except a DROP TABLE that, with
1469
+ * foreign keys on, first deletes the rows of a table that foreign keys
1470
+ * reference.
1471
+ *
1472
+ * Wasm type `j(i)`. Signature `["sqlite3_total_changes64", "i64", "sqlite3*"]`
1473
+ * from SQLite's table.
1474
+ *
1475
+ * See https://sqlite.org/c3ref/total_changes.html.
1476
+ */
1477
+ export const sqlite3_total_changes64 = (
1478
+ deps: SqliteWasmDep,
1479
+ ): SqliteCExports["sqlite3_total_changes64"] =>
1480
+ deps.sqliteWasm.exports.sqlite3_total_changes64;
1481
+
1482
+ /**
1483
+ * Runs zero or more semicolon-separated UTF-8 SQL statements, stopping at the
1484
+ * first error, and calls the callback, unless NULL, with pArg for each result
1485
+ * row; a non-zero callback result stops with SQLITE_ABORT. Unless errmsg is
1486
+ * NULL, it receives NULL on success or an error message the caller frees with
1487
+ * {@link sqlite3_free}.
1488
+ *
1489
+ * Wasm type `i(iiiii)`. Signature `["sqlite3_exec", "int", "sqlite3*",
1490
+ * "string:flexible", "funcptr:i(pipp)", "*", "**"]` from SQLite's table.
1491
+ *
1492
+ * See https://sqlite.org/c3ref/exec.html.
1493
+ */
1494
+ export const sqlite3_exec = (
1495
+ deps: SqliteWasmDep,
1496
+ ): SqliteCExports["sqlite3_exec"] => deps.sqliteWasm.exports.sqlite3_exec;
1497
+
1498
+ /**
1499
+ * Copies a schema, NULL meaning main, into memory from {@link sqlite3_malloc64}
1500
+ * that the caller frees, writing its byte size as an 8-byte sqlite3_int64 to
1501
+ * piSize unless NULL. An empty database first gets its first page from an empty
1502
+ * write transaction. Pages are read through the pager, so an encrypted database
1503
+ * comes out decrypted, and a page that fails to read comes out zero-filled.
1504
+ * Returns NULL when out of memory, for an unknown schema or a database without
1505
+ * pages, and with SQLITE_SERIALIZE_NOCOPY returns SQLite's own buffer of a
1506
+ * deserialized database, or NULL, instead of a copy, which the caller must
1507
+ * neither free nor modify. Only a call whose mFlags is 0 returns memory
1508
+ * {@link sqlite3_free} accepts.
1509
+ *
1510
+ * Wasm type `i(iiii)`. Signature `["sqlite3_serialize", "*", "sqlite3*",
1511
+ * "string", "*", "int"]` from SQLite's table.
1512
+ *
1513
+ * See https://sqlite.org/c3ref/serialize.html.
1514
+ */
1515
+ export const sqlite3_serialize = (
1516
+ deps: SqliteWasmDep,
1517
+ ): SqliteCExports["sqlite3_serialize"] =>
1518
+ deps.sqliteWasm.exports.sqlite3_serialize;
1519
+
1520
+ /**
1521
+ * Reopens a schema, main for NULL, as an in-memory database over the first szDb
1522
+ * bytes of a szBuf-byte buffer, which must stay valid and unmodified until the
1523
+ * connection closes. With SQLITE_DESERIALIZE_FREEONCLOSE, SQLite takes
1524
+ * ownership of the {@link sqlite3_malloc}'d buffer and frees it, even when
1525
+ * deserializing fails.
1526
+ *
1527
+ * Wasm type `i(iiijji)`. Signature `["sqlite3_deserialize", "int", "sqlite3*",
1528
+ * "string", "*", "i64", "i64", "int"]` from SQLite's table.
1529
+ *
1530
+ * See https://sqlite.org/c3ref/deserialize.html.
1531
+ */
1532
+ export const sqlite3_deserialize = (
1533
+ deps: SqliteWasmDep,
1534
+ ): SqliteCExports["sqlite3_deserialize"] =>
1535
+ deps.sqliteWasm.exports.sqlite3_deserialize;
1536
+
1537
+ /**
1538
+ * Returns the result code of the connection's most recent API call if that call
1539
+ * failed, as a primary code unless extended result codes are enabled.
1540
+ *
1541
+ * Wasm type `i(i)`. Signature `["sqlite3_errcode", "int", "sqlite3*"]` from
1542
+ * SQLite's table.
1543
+ *
1544
+ * See https://sqlite.org/c3ref/errcode.html.
1545
+ */
1546
+ export const sqlite3_errcode = (
1547
+ deps: SqliteWasmDep,
1548
+ ): SqliteCExports["sqlite3_errcode"] => deps.sqliteWasm.exports.sqlite3_errcode;
1549
+
1550
+ /**
1551
+ * Returns the connection's most recent extended result code.
1552
+ *
1553
+ * Wasm type `i(i)`. Signature `["sqlite3_extended_errcode", "int", "sqlite3*"]`
1554
+ * from SQLite's table.
1555
+ *
1556
+ * See https://sqlite.org/c3ref/errcode.html.
1557
+ */
1558
+ export const sqlite3_extended_errcode = (
1559
+ deps: SqliteWasmDep,
1560
+ ): SqliteCExports["sqlite3_extended_errcode"] =>
1561
+ deps.sqliteWasm.exports.sqlite3_extended_errcode;
1562
+
1563
+ /**
1564
+ * Returns the English message of the connection's most recent error, or NULL
1565
+ * when none is available. SQLite owns the string, which the next call on the
1566
+ * connection can overwrite or free.
1567
+ *
1568
+ * Wasm type `i(i)`. Signature `["sqlite3_errmsg", "string", "sqlite3*"]` from
1569
+ * SQLite's table.
1570
+ *
1571
+ * See https://sqlite.org/c3ref/errcode.html.
1572
+ */
1573
+ export const sqlite3_errmsg = (
1574
+ deps: SqliteWasmDep,
1575
+ ): SqliteCExports["sqlite3_errmsg"] => deps.sqliteWasm.exports.sqlite3_errmsg;
1576
+
1577
+ /**
1578
+ * Returns the English description of a result code, or NULL when none is
1579
+ * available. The string is static and must not be freed.
1580
+ *
1581
+ * Wasm type `i(i)`. Signature `["sqlite3_errstr", "string", "int"]` from
1582
+ * SQLite's table.
1583
+ *
1584
+ * See https://sqlite.org/c3ref/errcode.html.
1585
+ */
1586
+ export const sqlite3_errstr = (
1587
+ deps: SqliteWasmDep,
1588
+ ): SqliteCExports["sqlite3_errstr"] => deps.sqliteWasm.exports.sqlite3_errstr;
1589
+
1590
+ /**
1591
+ * Returns the byte offset in the SQL of the most recent error, or -1.
1592
+ *
1593
+ * Wasm type `i(i)`. Signature `["sqlite3_error_offset", "int", "sqlite3*"]`
1594
+ * from SQLite's table.
1595
+ *
1596
+ * See https://sqlite.org/c3ref/errcode.html.
1597
+ */
1598
+ export const sqlite3_error_offset = (
1599
+ deps: SqliteWasmDep,
1600
+ ): SqliteCExports["sqlite3_error_offset"] =>
1601
+ deps.sqliteWasm.exports.sqlite3_error_offset;
1602
+
1603
+ /**
1604
+ * Sets the error code and a copy of zErrMsg, or the code's default message for
1605
+ * NULL, that {@link sqlite3_errcode} and {@link sqlite3_errmsg} report for a
1606
+ * connection until SQLite or another call replaces them.
1607
+ *
1608
+ * Wasm type `i(iii)`. Signature `["sqlite3_set_errmsg", "int", "sqlite3*",
1609
+ * "int", "string"]` from SQLite's table.
1610
+ *
1611
+ * See https://sqlite.org/c3ref/set_errmsg.html.
1612
+ */
1613
+ export const sqlite3_set_errmsg = (
1614
+ deps: SqliteWasmDep,
1615
+ ): SqliteCExports["sqlite3_set_errmsg"] =>
1616
+ deps.sqliteWasm.exports.sqlite3_set_errmsg;
1617
+
1618
+ /**
1619
+ * Sets the connection's commit callback, replacing the previous one, or removes
1620
+ * it for NULL, and returns the previous call's pArg, NULL for the first call.
1621
+ * SQLite calls it with pArg before each commit and turns the commit into a
1622
+ * rollback when it returns non-zero; it must not modify the connection.
1623
+ *
1624
+ * Wasm type `i(iii)`. Signature `["sqlite3_commit_hook", "void*", "sqlite3*",
1625
+ * "funcptr:i(p)", "*"]` from SQLite's table.
1626
+ *
1627
+ * See https://sqlite.org/c3ref/commit_hook.html.
1628
+ */
1629
+ export const sqlite3_commit_hook = (
1630
+ deps: SqliteWasmDep,
1631
+ ): SqliteCExports["sqlite3_commit_hook"] =>
1632
+ deps.sqliteWasm.exports.sqlite3_commit_hook;
1633
+
1634
+ /**
1635
+ * Registers the callback SQLite calls with pArg whenever a transaction rolls
1636
+ * back, except when closing the connection, replacing the previous one; NULL
1637
+ * removes it. Returns the previous pArg or NULL; the callback must not use the
1638
+ * connection, not even to prepare or step a statement.
1639
+ *
1640
+ * Wasm type `i(iii)`. Signature `["sqlite3_rollback_hook", "void*", "sqlite3*",
1641
+ * "funcptr:v(p)", "*"]` from SQLite's table.
1642
+ *
1643
+ * See https://sqlite.org/c3ref/commit_hook.html.
1644
+ */
1645
+ export const sqlite3_rollback_hook = (
1646
+ deps: SqliteWasmDep,
1647
+ ): SqliteCExports["sqlite3_rollback_hook"] =>
1648
+ deps.sqliteWasm.exports.sqlite3_rollback_hook;
1649
+
1650
+ /**
1651
+ * Registers the connection's callback for each row inserted, updated or deleted
1652
+ * in a rowid table, replacing the previous one or removing it for NULL, and
1653
+ * returns the previous pArg or NULL. The callback must not modify the
1654
+ * connection and does not fire for WITHOUT ROWID tables, REPLACE conflict
1655
+ * deletions or the truncate optimization.
1656
+ *
1657
+ * Wasm type `i(iii)`. Signature `["sqlite3_update_hook", "*", "sqlite3*",
1658
+ * "funcptr:v(pippj)", "*"]` from SQLite's table.
1659
+ *
1660
+ * See https://sqlite.org/c3ref/update_hook.html.
1661
+ */
1662
+ export const sqlite3_update_hook = (
1663
+ deps: SqliteWasmDep,
1664
+ ): SqliteCExports["sqlite3_update_hook"] =>
1665
+ deps.sqliteWasm.exports.sqlite3_update_hook;
1666
+
1667
+ /**
1668
+ * Registers the connection's one trace callback for the SQLITE_TRACE_* events
1669
+ * in uMask, replacing any previous one; a NULL callback or a zero mask disables
1670
+ * tracing. The callback receives the event code, pCtx and two event-specific
1671
+ * pointers, and should return 0.
1672
+ *
1673
+ * Wasm type `i(iiii)`. Signature `["sqlite3_trace_v2", "int", "sqlite3*",
1674
+ * "int", "funcptr:i(ippp)", "*"]` from SQLite's table.
1675
+ *
1676
+ * See https://sqlite.org/c3ref/trace_v2.html.
1677
+ */
1678
+ export const sqlite3_trace_v2 = (
1679
+ deps: SqliteWasmDep,
1680
+ ): SqliteCExports["sqlite3_trace_v2"] =>
1681
+ deps.sqliteWasm.exports.sqlite3_trace_v2;
1682
+
1683
+ /**
1684
+ * Sets the connection's callback for an undefined collation sequence, replacing
1685
+ * the previous one. SQLite calls it with pArg, the connection, the preferred
1686
+ * text encoding and the UTF-8 collation name, and the callback should register
1687
+ * that collation.
1688
+ *
1689
+ * Wasm type `i(iii)`. Signature `["sqlite3_collation_needed", "int",
1690
+ * "sqlite3*", "*", "*"]` from SQLite's table.
1691
+ *
1692
+ * See https://sqlite.org/c3ref/collation_needed.html.
1693
+ */
1694
+ export const sqlite3_collation_needed = (
1695
+ deps: SqliteWasmDep,
1696
+ ): SqliteCExports["sqlite3_collation_needed"] =>
1697
+ deps.sqliteWasm.exports.sqlite3_collation_needed;
1698
+
1699
+ /**
1700
+ * Compiles the first statement of UTF-8 SQL as {@link sqlite3_prepare_v3} does
1701
+ * with no flags, reading at most nByte bytes or up to a NUL when nByte is
1702
+ * negative, and writes the statement to `*ppStmt` and the address of the
1703
+ * uncompiled rest to `*pzTail`. `*ppStmt` is NULL on error and for SQL without
1704
+ * a statement, such as only a comment; the caller finalizes a non-NULL one.
1705
+ *
1706
+ * Wasm type `i(iiiii)`. Signature `["sqlite3_prepare_v2", "int", "sqlite3*",
1707
+ * "*", "int", "**", "**"]` from Evolu's supplement: SQLite binds it by hand to
1708
+ * accept JavaScript strings.
1709
+ *
1710
+ * See https://sqlite.org/c3ref/prepare.html.
1711
+ */
1712
+ export const sqlite3_prepare_v2 = (
1713
+ deps: SqliteWasmDep,
1714
+ ): SqliteCExports["sqlite3_prepare_v2"] =>
1715
+ deps.sqliteWasm.exports.sqlite3_prepare_v2;
1716
+
1717
+ /**
1718
+ * Compiles the first statement of UTF-8 SQL, reading at most nByte bytes or up
1719
+ * to a NUL when nByte is negative, and writes the statement to `*ppStmt` and
1720
+ * the address of the uncompiled rest to `*pzTail`. `*ppStmt` is NULL on error
1721
+ * and for SQL without a statement, such as only a comment; the caller finalizes
1722
+ * a non-NULL one.
1723
+ *
1724
+ * Wasm type `i(iiiiii)`. Signature `["sqlite3_prepare_v3", "int", "sqlite3*",
1725
+ * "*", "int", "int", "**", "**"]` from Evolu's supplement: SQLite binds it by
1726
+ * hand to accept JavaScript strings.
1727
+ *
1728
+ * See https://sqlite.org/c3ref/prepare.html.
1729
+ */
1730
+ export const sqlite3_prepare_v3 = (
1731
+ deps: SqliteWasmDep,
1732
+ ): SqliteCExports["sqlite3_prepare_v3"] =>
1733
+ deps.sqliteWasm.exports.sqlite3_prepare_v3;
1734
+
1735
+ /**
1736
+ * Evaluates a statement one step, returning SQLITE_ROW, SQLITE_DONE or an
1737
+ * error.
1738
+ *
1739
+ * Wasm type `i(i)`. Signature `["sqlite3_step", "int", "sqlite3_stmt*"]` from
1740
+ * SQLite's table.
1741
+ *
1742
+ * See https://sqlite.org/c3ref/step.html.
1743
+ */
1744
+ export const sqlite3_step = (
1745
+ deps: SqliteWasmDep,
1746
+ ): SqliteCExports["sqlite3_step"] => deps.sqliteWasm.exports.sqlite3_step;
1747
+
1748
+ /**
1749
+ * Resets a statement so it can run again, keeping its bindings. It returns the
1750
+ * error of a failed most recent step, and can fail on its own, such as with
1751
+ * SQLITE_BUSY when an INSERT with RETURNING stepped only once cannot commit.
1752
+ *
1753
+ * Wasm type `i(i)`. Signature `["sqlite3_reset", "int", "sqlite3_stmt*"]` from
1754
+ * SQLite's table.
1755
+ *
1756
+ * See https://sqlite.org/c3ref/reset.html.
1757
+ */
1758
+ export const sqlite3_reset = (
1759
+ deps: SqliteWasmDep,
1760
+ ): SqliteCExports["sqlite3_reset"] => deps.sqliteWasm.exports.sqlite3_reset;
1761
+
1762
+ /**
1763
+ * Destroys a prepared statement and returns the error of its most recent
1764
+ * evaluation if that failed, otherwise SQLITE_OK; NULL is a harmless no-op.
1765
+ *
1766
+ * Wasm type `i(i)`. Signature `["sqlite3_finalize", "int", "sqlite3_stmt*"]`
1767
+ * from SQLite's table.
1768
+ *
1769
+ * See https://sqlite.org/c3ref/finalize.html.
1770
+ */
1771
+ export const sqlite3_finalize = (
1772
+ deps: SqliteWasmDep,
1773
+ ): SqliteCExports["sqlite3_finalize"] =>
1774
+ deps.sqliteWasm.exports.sqlite3_finalize;
1775
+
1776
+ /**
1777
+ * Returns the connection's first prepared statement for a NULL pStmt, otherwise
1778
+ * the one after pStmt, or NULL when there is none.
1779
+ *
1780
+ * Wasm type `i(ii)`. Signature `["sqlite3_next_stmt", "sqlite3_stmt*",
1781
+ * "sqlite3*", "sqlite3_stmt*"]` from SQLite's table.
1782
+ *
1783
+ * See https://sqlite.org/c3ref/next_stmt.html.
1784
+ */
1785
+ export const sqlite3_next_stmt = (
1786
+ deps: SqliteWasmDep,
1787
+ ): SqliteCExports["sqlite3_next_stmt"] =>
1788
+ deps.sqliteWasm.exports.sqlite3_next_stmt;
1789
+
1790
+ /**
1791
+ * Returns the connection a prepared statement belongs to.
1792
+ *
1793
+ * Wasm type `i(i)`. Signature `["sqlite3_db_handle", "sqlite3*",
1794
+ * "sqlite3_stmt*"]` from SQLite's table.
1795
+ *
1796
+ * See https://sqlite.org/c3ref/db_handle.html.
1797
+ */
1798
+ export const sqlite3_db_handle = (
1799
+ deps: SqliteWasmDep,
1800
+ ): SqliteCExports["sqlite3_db_handle"] =>
1801
+ deps.sqliteWasm.exports.sqlite3_db_handle;
1802
+
1803
+ /**
1804
+ * Returns the SQL text a statement was prepared from, which SQLite frees when
1805
+ * the statement is finalized, or NULL for a statement from the legacy
1806
+ * sqlite3_prepare, which this build does not export.
1807
+ *
1808
+ * Wasm type `i(i)`. Signature `["sqlite3_sql", "string", "sqlite3_stmt*"]` from
1809
+ * SQLite's table.
1810
+ *
1811
+ * See https://sqlite.org/c3ref/expanded_sql.html.
1812
+ */
1813
+ export const sqlite3_sql = (
1814
+ deps: SqliteWasmDep,
1815
+ ): SqliteCExports["sqlite3_sql"] => deps.sqliteWasm.exports.sqlite3_sql;
1816
+
1817
+ /**
1818
+ * Returns the statement's SQL with bound parameters expanded as literals, in
1819
+ * memory the caller frees with {@link sqlite3_free}, or NULL when out of memory,
1820
+ * above SQLITE_LIMIT_LENGTH, or when built with SQLITE_OMIT_TRACE.
1821
+ *
1822
+ * Wasm type `i(i)`. Signature `["sqlite3_expanded_sql", "string",
1823
+ * "sqlite3_stmt*"]` from SQLite's table.
1824
+ *
1825
+ * See https://sqlite.org/c3ref/expanded_sql.html.
1826
+ */
1827
+ export const sqlite3_expanded_sql = (
1828
+ deps: SqliteWasmDep,
1829
+ ): SqliteCExports["sqlite3_expanded_sql"] =>
1830
+ deps.sqliteWasm.exports.sqlite3_expanded_sql;
1831
+
1832
+ /**
1833
+ * Returns non-zero when a statement has been stepped but has neither returned
1834
+ * SQLITE_DONE nor been reset, and 0 for NULL.
1835
+ *
1836
+ * Wasm type `i(i)`. Signature `["sqlite3_stmt_busy", "int", "sqlite3_stmt*"]`
1837
+ * from SQLite's table.
1838
+ *
1839
+ * See https://sqlite.org/c3ref/stmt_busy.html.
1840
+ */
1841
+ export const sqlite3_stmt_busy = (
1842
+ deps: SqliteWasmDep,
1843
+ ): SqliteCExports["sqlite3_stmt_busy"] =>
1844
+ deps.sqliteWasm.exports.sqlite3_stmt_busy;
1845
+
1846
+ /**
1847
+ * Returns non-zero when a statement cannot directly change the database file,
1848
+ * though application-defined functions or virtual tables it calls still might.
1849
+ * Transaction control, ATTACH and DETACH count as read-only; BEGIN IMMEDIATE,
1850
+ * BEGIN EXCLUSIVE and any statement that might write do not.
1851
+ *
1852
+ * Wasm type `i(i)`. Signature `["sqlite3_stmt_readonly", "int",
1853
+ * "sqlite3_stmt*"]` from SQLite's table.
1854
+ *
1855
+ * See https://sqlite.org/c3ref/stmt_readonly.html.
1856
+ */
1857
+ export const sqlite3_stmt_readonly = (
1858
+ deps: SqliteWasmDep,
1859
+ ): SqliteCExports["sqlite3_stmt_readonly"] =>
1860
+ deps.sqliteWasm.exports.sqlite3_stmt_readonly;
1861
+
1862
+ /**
1863
+ * Makes a statement behave as if its SQL began with EXPLAIN (eMode 1), EXPLAIN
1864
+ * QUERY PLAN (2) or neither (0), possibly re-preparing it. It fails while the
1865
+ * statement is active, so reset it first.
1866
+ *
1867
+ * Wasm type `i(ii)`. Signature `["sqlite3_stmt_explain", "int",
1868
+ * "sqlite3_stmt*", "int"]` from SQLite's table.
1869
+ *
1870
+ * See https://sqlite.org/c3ref/stmt_explain.html.
1871
+ */
1872
+ export const sqlite3_stmt_explain = (
1873
+ deps: SqliteWasmDep,
1874
+ ): SqliteCExports["sqlite3_stmt_explain"] =>
1875
+ deps.sqliteWasm.exports.sqlite3_stmt_explain;
1876
+
1877
+ /**
1878
+ * Returns 1 for an EXPLAIN statement, 2 for EXPLAIN QUERY PLAN, and 0 for an
1879
+ * ordinary statement or NULL.
1880
+ *
1881
+ * Wasm type `i(i)`. Signature `["sqlite3_stmt_isexplain", "int",
1882
+ * "sqlite3_stmt*"]` from SQLite's table.
1883
+ *
1884
+ * See https://sqlite.org/c3ref/stmt_isexplain.html.
1885
+ */
1886
+ export const sqlite3_stmt_isexplain = (
1887
+ deps: SqliteWasmDep,
1888
+ ): SqliteCExports["sqlite3_stmt_isexplain"] =>
1889
+ deps.sqliteWasm.exports.sqlite3_stmt_isexplain;
1890
+
1891
+ /**
1892
+ * Returns one of a statement's SQLITE_STMTSTATUS_* counters, and resets it to 0
1893
+ * afterwards when resetFlg is non-zero.
1894
+ *
1895
+ * Wasm type `i(iii)`. Signature `["sqlite3_stmt_status", "int",
1896
+ * "sqlite3_stmt*", "int", "int"]` from SQLite's table.
1897
+ *
1898
+ * See https://sqlite.org/c3ref/stmt_status.html.
1899
+ */
1900
+ export const sqlite3_stmt_status = (
1901
+ deps: SqliteWasmDep,
1902
+ ): SqliteCExports["sqlite3_stmt_status"] =>
1903
+ deps.sqliteWasm.exports.sqlite3_stmt_status;
1904
+
1905
+ /**
1906
+ * Returns the index of a statement's largest SQL parameter, which is the number
1907
+ * of parameters unless `?NNN` parameters leave gaps.
1908
+ *
1909
+ * Wasm type `i(i)`. Signature `["sqlite3_bind_parameter_count", "int",
1910
+ * "sqlite3_stmt*"]` from SQLite's table.
1911
+ *
1912
+ * See https://sqlite.org/c3ref/bind_parameter_count.html.
1913
+ */
1914
+ export const sqlite3_bind_parameter_count = (
1915
+ deps: SqliteWasmDep,
1916
+ ): SqliteCExports["sqlite3_bind_parameter_count"] =>
1917
+ deps.sqliteWasm.exports.sqlite3_bind_parameter_count;
1918
+
1919
+ /**
1920
+ * Returns the 1-based index of the SQL parameter with a UTF-8 name that
1921
+ * includes its prefix, such as `:name`, or 0 when no parameter matches.
1922
+ *
1923
+ * Wasm type `i(ii)`. Signature `["sqlite3_bind_parameter_index", "int",
1924
+ * "sqlite3_stmt*", "string"]` from SQLite's table.
1925
+ *
1926
+ * See https://sqlite.org/c3ref/bind_parameter_index.html.
1927
+ */
1928
+ export const sqlite3_bind_parameter_index = (
1929
+ deps: SqliteWasmDep,
1930
+ ): SqliteCExports["sqlite3_bind_parameter_index"] =>
1931
+ deps.sqliteWasm.exports.sqlite3_bind_parameter_index;
1932
+
1933
+ /**
1934
+ * Returns the name of the SQL parameter at a 1-based index, including its
1935
+ * prefix as in `:name` or `?NNN`, or NULL for a nameless `?` parameter or an
1936
+ * index out of range. The statement owns the string.
1937
+ *
1938
+ * Wasm type `i(ii)`. Signature `["sqlite3_bind_parameter_name", "string",
1939
+ * "sqlite3_stmt*", "int"]` from SQLite's table.
1940
+ *
1941
+ * See https://sqlite.org/c3ref/bind_parameter_name.html.
1942
+ */
1943
+ export const sqlite3_bind_parameter_name = (
1944
+ deps: SqliteWasmDep,
1945
+ ): SqliteCExports["sqlite3_bind_parameter_name"] =>
1946
+ deps.sqliteWasm.exports.sqlite3_bind_parameter_name;
1947
+
1948
+ /**
1949
+ * Binds NULL to a parameter.
1950
+ *
1951
+ * Wasm type `i(ii)`. Signature `["sqlite3_bind_null", undefined,
1952
+ * "sqlite3_stmt*", "int"]` from SQLite's table, with the result corrected:
1953
+ * SQLite's table declares no result, but the C function returns a result code,
1954
+ * as the wasm type shows.
1955
+ *
1956
+ * See https://sqlite.org/c3ref/bind_blob.html.
1957
+ */
1958
+ export const sqlite3_bind_null = (
1959
+ deps: SqliteWasmDep,
1960
+ ): SqliteCExports["sqlite3_bind_null"] =>
1961
+ deps.sqliteWasm.exports.sqlite3_bind_null;
1962
+
1963
+ /**
1964
+ * Binds a 32-bit integer to a parameter. The wasm boundary converts the number
1965
+ * with ToInt32, so a fraction is truncated and a value outside the int32 range
1966
+ * wraps silently.
1967
+ *
1968
+ * Wasm type `i(iii)`. Signature `["sqlite3_bind_int", "int", "sqlite3_stmt*",
1969
+ * "int", "int"]` from SQLite's table.
1970
+ *
1971
+ * See https://sqlite.org/c3ref/bind_blob.html.
1972
+ */
1973
+ export const sqlite3_bind_int = (
1974
+ deps: SqliteWasmDep,
1975
+ ): SqliteCExports["sqlite3_bind_int"] =>
1976
+ deps.sqliteWasm.exports.sqlite3_bind_int;
1977
+
1978
+ /**
1979
+ * Binds a 64-bit integer to a parameter. The wasm boundary wraps a bigint
1980
+ * outside the int64 range silently.
1981
+ *
1982
+ * Wasm type `i(iij)`. Signature `["sqlite3_bind_int64", "int", "sqlite3_stmt*",
1983
+ * "int", "i64"]` from SQLite's table.
1984
+ *
1985
+ * See https://sqlite.org/c3ref/bind_blob.html.
1986
+ */
1987
+ export const sqlite3_bind_int64 = (
1988
+ deps: SqliteWasmDep,
1989
+ ): SqliteCExports["sqlite3_bind_int64"] =>
1990
+ deps.sqliteWasm.exports.sqlite3_bind_int64;
1991
+
1992
+ /**
1993
+ * Binds a double to a parameter; SQLite stores NaN as NULL.
1994
+ *
1995
+ * Wasm type `i(iid)`. Signature `["sqlite3_bind_double", "int",
1996
+ * "sqlite3_stmt*", "int", "f64"]` from SQLite's table.
1997
+ *
1998
+ * See https://sqlite.org/c3ref/bind_blob.html.
1999
+ */
2000
+ export const sqlite3_bind_double = (
2001
+ deps: SqliteWasmDep,
2002
+ ): SqliteCExports["sqlite3_bind_double"] =>
2003
+ deps.sqliteWasm.exports.sqlite3_bind_double;
2004
+
2005
+ /**
2006
+ * Binds UTF-8 text to a parameter: n bytes, which may include NUL characters,
2007
+ * or up to the first NUL when n is negative. A NULL address binds SQL NULL.
2008
+ *
2009
+ * Wasm type `i(iiiii)`. Signature `["sqlite3_bind_text", "int",
2010
+ * "sqlite3_stmt*", "int", "*", "int", "*"]` from Evolu's supplement: SQLite
2011
+ * binds it by hand to accept JavaScript strings and typed arrays.
2012
+ *
2013
+ * See https://sqlite.org/c3ref/bind_blob.html.
2014
+ */
2015
+ export const sqlite3_bind_text = (
2016
+ deps: SqliteWasmDep,
2017
+ ): SqliteCExports["sqlite3_bind_text"] =>
2018
+ deps.sqliteWasm.exports.sqlite3_bind_text;
2019
+
2020
+ /**
2021
+ * Binds n bytes to a parameter; a negative n is undefined behavior. A NULL
2022
+ * address binds SQL NULL, so an empty blob needs a non-NULL address.
2023
+ *
2024
+ * Wasm type `i(iiiii)`. Signature `["sqlite3_bind_blob", "int",
2025
+ * "sqlite3_stmt*", "int", "*", "int", "*"]` from Evolu's supplement: SQLite
2026
+ * binds it by hand to accept typed arrays.
2027
+ *
2028
+ * See https://sqlite.org/c3ref/bind_blob.html.
2029
+ */
2030
+ export const sqlite3_bind_blob = (
2031
+ deps: SqliteWasmDep,
2032
+ ): SqliteCExports["sqlite3_bind_blob"] =>
2033
+ deps.sqliteWasm.exports.sqlite3_bind_blob;
2034
+
2035
+ /**
2036
+ * Binds a blob of n zero bytes to a parameter without allocating its content; a
2037
+ * negative n binds a zero-length blob.
2038
+ *
2039
+ * Wasm type `i(iii)`. Signature `["sqlite3_bind_zeroblob", "int",
2040
+ * "sqlite3_stmt*", "int", "int"]` from SQLite's table.
2041
+ *
2042
+ * See https://sqlite.org/c3ref/bind_blob.html.
2043
+ */
2044
+ export const sqlite3_bind_zeroblob = (
2045
+ deps: SqliteWasmDep,
2046
+ ): SqliteCExports["sqlite3_bind_zeroblob"] =>
2047
+ deps.sqliteWasm.exports.sqlite3_bind_zeroblob;
2048
+
2049
+ /**
2050
+ * Binds SQL NULL carrying pPtr tagged with the type string zPType, which only
2051
+ * {@link sqlite3_value_pointer} with an equal type string returns. The type
2052
+ * string should be static because SQLite keeps its address, and SQLite calls
2053
+ * xDestructor, unless NULL, with pPtr when done, even when binding fails.
2054
+ *
2055
+ * Wasm type `i(iiiii)`. Signature `["sqlite3_bind_pointer", "int",
2056
+ * "sqlite3_stmt*", "int", "*", "string:static", "*"]` from SQLite's table.
2057
+ *
2058
+ * See https://sqlite.org/c3ref/bind_blob.html.
2059
+ */
2060
+ export const sqlite3_bind_pointer = (
2061
+ deps: SqliteWasmDep,
2062
+ ): SqliteCExports["sqlite3_bind_pointer"] =>
2063
+ deps.sqliteWasm.exports.sqlite3_bind_pointer;
2064
+
2065
+ /**
2066
+ * Sets every parameter of a statement to NULL, which {@link sqlite3_reset} does
2067
+ * not do.
2068
+ *
2069
+ * Wasm type `i(i)`. Signature `["sqlite3_clear_bindings", "int",
2070
+ * "sqlite3_stmt*"]` from SQLite's table.
2071
+ *
2072
+ * See https://sqlite.org/c3ref/clear_bindings.html.
2073
+ */
2074
+ export const sqlite3_clear_bindings = (
2075
+ deps: SqliteWasmDep,
2076
+ ): SqliteCExports["sqlite3_clear_bindings"] =>
2077
+ deps.sqliteWasm.exports.sqlite3_clear_bindings;
2078
+
2079
+ /**
2080
+ * Returns the number of result columns of a statement.
2081
+ *
2082
+ * Wasm type `i(i)`. Signature `["sqlite3_column_count", "int",
2083
+ * "sqlite3_stmt*"]` from SQLite's table.
2084
+ *
2085
+ * See https://sqlite.org/c3ref/column_count.html.
2086
+ */
2087
+ export const sqlite3_column_count = (
2088
+ deps: SqliteWasmDep,
2089
+ ): SqliteCExports["sqlite3_column_count"] =>
2090
+ deps.sqliteWasm.exports.sqlite3_column_count;
2091
+
2092
+ /**
2093
+ * Returns the number of columns in the statement's current row, or 0 when the
2094
+ * last step did not return SQLITE_ROW or the statement is NULL.
2095
+ *
2096
+ * Wasm type `i(i)`. Signature `["sqlite3_data_count", "int", "sqlite3_stmt*"]`
2097
+ * from SQLite's table.
2098
+ *
2099
+ * See https://sqlite.org/c3ref/data_count.html.
2100
+ */
2101
+ export const sqlite3_data_count = (
2102
+ deps: SqliteWasmDep,
2103
+ ): SqliteCExports["sqlite3_data_count"] =>
2104
+ deps.sqliteWasm.exports.sqlite3_data_count;
2105
+
2106
+ /**
2107
+ * Returns the name of a result column, which is its AS alias or else
2108
+ * unspecified, or NULL when out of memory or the index is out of range. The
2109
+ * statement owns the string until it is finalized or re-prepared.
2110
+ *
2111
+ * Wasm type `i(ii)`. Signature `["sqlite3_column_name", "string",
2112
+ * "sqlite3_stmt*", "int"]` from SQLite's table.
2113
+ *
2114
+ * See https://sqlite.org/c3ref/column_name.html.
2115
+ */
2116
+ export const sqlite3_column_name = (
2117
+ deps: SqliteWasmDep,
2118
+ ): SqliteCExports["sqlite3_column_name"] =>
2119
+ deps.sqliteWasm.exports.sqlite3_column_name;
2120
+
2121
+ /**
2122
+ * Returns the declared type of the table column a result column comes from, or
2123
+ * NULL when the result column is an expression or subquery. The statement owns
2124
+ * the string.
2125
+ *
2126
+ * Wasm type `i(ii)`. Signature `["sqlite3_column_decltype", "string",
2127
+ * "sqlite3_stmt*", "int"]` from SQLite's table.
2128
+ *
2129
+ * See https://sqlite.org/c3ref/column_decltype.html.
2130
+ */
2131
+ export const sqlite3_column_decltype = (
2132
+ deps: SqliteWasmDep,
2133
+ ): SqliteCExports["sqlite3_column_decltype"] =>
2134
+ deps.sqliteWasm.exports.sqlite3_column_decltype;
2135
+
2136
+ /**
2137
+ * Returns the storage class of a result column in the current row. Read it
2138
+ * before any other column function, which can convert the value.
2139
+ *
2140
+ * Wasm type `i(ii)`. Signature `["sqlite3_column_type", "int", "sqlite3_stmt*",
2141
+ * "int"]` from SQLite's table.
2142
+ *
2143
+ * See https://sqlite.org/c3ref/column_blob.html.
2144
+ */
2145
+ export const sqlite3_column_type = (
2146
+ deps: SqliteWasmDep,
2147
+ ): SqliteCExports["sqlite3_column_type"] =>
2148
+ deps.sqliteWasm.exports.sqlite3_column_type;
2149
+
2150
+ /**
2151
+ * Returns a result column of the current row as a 32-bit integer, converting
2152
+ * other types; an integer outside the 32-bit range keeps only its low 32 bits.
2153
+ *
2154
+ * Wasm type `i(ii)`. Signature `["sqlite3_column_int", "int", "sqlite3_stmt*",
2155
+ * "int"]` from SQLite's table.
2156
+ *
2157
+ * See https://sqlite.org/c3ref/column_blob.html.
2158
+ */
2159
+ export const sqlite3_column_int = (
2160
+ deps: SqliteWasmDep,
2161
+ ): SqliteCExports["sqlite3_column_int"] =>
2162
+ deps.sqliteWasm.exports.sqlite3_column_int;
2163
+
2164
+ /**
2165
+ * Returns a result column of the current row as a 64-bit integer, converting
2166
+ * other types as CAST does, and 0 for NULL.
2167
+ *
2168
+ * Wasm type `j(ii)`. Signature `["sqlite3_column_int64", "i64",
2169
+ * "sqlite3_stmt*", "int"]` from SQLite's table.
2170
+ *
2171
+ * See https://sqlite.org/c3ref/column_blob.html.
2172
+ */
2173
+ export const sqlite3_column_int64 = (
2174
+ deps: SqliteWasmDep,
2175
+ ): SqliteCExports["sqlite3_column_int64"] =>
2176
+ deps.sqliteWasm.exports.sqlite3_column_int64;
2177
+
2178
+ /**
2179
+ * Returns a result column of the current row as a double, converting other
2180
+ * types, such as NULL to 0.0.
2181
+ *
2182
+ * Wasm type `d(ii)`. Signature `["sqlite3_column_double", "f64",
2183
+ * "sqlite3_stmt*", "int"]` from SQLite's table.
2184
+ *
2185
+ * See https://sqlite.org/c3ref/column_blob.html.
2186
+ */
2187
+ export const sqlite3_column_double = (
2188
+ deps: SqliteWasmDep,
2189
+ ): SqliteCExports["sqlite3_column_double"] =>
2190
+ deps.sqliteWasm.exports.sqlite3_column_double;
2191
+
2192
+ /**
2193
+ * Returns the address of a result column as NUL-terminated UTF-8 text that can
2194
+ * contain NUL characters, so read its length with {@link sqlite3_column_bytes}
2195
+ * afterwards. Returns NULL for SQL NULL and when out of memory, which
2196
+ * {@link sqlite3_errcode} tells apart; the text stays valid until the next step,
2197
+ * reset or finalize, or a conversion by another column call.
2198
+ *
2199
+ * Wasm type `i(ii)`. Signature `["sqlite3_column_text", "*", "sqlite3_stmt*",
2200
+ * "int"]` from Evolu's supplement: SQLite's build replaces it with a JavaScript
2201
+ * proxy that keeps embedded NUL characters (proxy-text-apis).
2202
+ *
2203
+ * See https://sqlite.org/c3ref/column_blob.html.
2204
+ */
2205
+ export const sqlite3_column_text = (
2206
+ deps: SqliteWasmDep,
2207
+ ): SqliteCExports["sqlite3_column_text"] =>
2208
+ deps.sqliteWasm.exports.sqlite3_column_text;
2209
+
2210
+ /**
2211
+ * Returns the address of a result column's bytes, or NULL for a zero-length
2212
+ * blob, SQL NULL or out of memory; call it before {@link sqlite3_column_bytes}.
2213
+ * The memory stays valid until a type conversion of the column or the next
2214
+ * step, reset or finalize, and SQLite frees it.
2215
+ *
2216
+ * Wasm type `i(ii)`. Signature `["sqlite3_column_blob", "*", "sqlite3_stmt*",
2217
+ * "int"]` from SQLite's table.
2218
+ *
2219
+ * See https://sqlite.org/c3ref/column_blob.html.
2220
+ */
2221
+ export const sqlite3_column_blob = (
2222
+ deps: SqliteWasmDep,
2223
+ ): SqliteCExports["sqlite3_column_blob"] =>
2224
+ deps.sqliteWasm.exports.sqlite3_column_blob;
2225
+
2226
+ /**
2227
+ * Returns the byte length of the text or blob the preceding column call
2228
+ * returned.
2229
+ *
2230
+ * Wasm type `i(ii)`. Signature `["sqlite3_column_bytes", "int",
2231
+ * "sqlite3_stmt*", "int"]` from SQLite's table.
2232
+ *
2233
+ * See https://sqlite.org/c3ref/column_blob.html.
2234
+ */
2235
+ export const sqlite3_column_bytes = (
2236
+ deps: SqliteWasmDep,
2237
+ ): SqliteCExports["sqlite3_column_bytes"] =>
2238
+ deps.sqliteWasm.exports.sqlite3_column_bytes;
2239
+
2240
+ /**
2241
+ * Returns a result column of the current row as an unprotected sqlite3_value,
2242
+ * valid until the next step, reset or finalize. This build is single-threaded
2243
+ * (SQLITE_THREADSAFE=0), so an unprotected value works wherever a protected one
2244
+ * does, and {@link sqlite3_value_dup} copies it to outlive the row.
2245
+ *
2246
+ * Wasm type `i(ii)`. Signature `["sqlite3_column_value", "sqlite3_value*",
2247
+ * "sqlite3_stmt*", "int"]` from SQLite's table.
2248
+ *
2249
+ * See https://sqlite.org/c3ref/column_blob.html.
2250
+ */
2251
+ export const sqlite3_column_value = (
2252
+ deps: SqliteWasmDep,
2253
+ ): SqliteCExports["sqlite3_column_value"] =>
2254
+ deps.sqliteWasm.exports.sqlite3_column_value;
2255
+
2256
+ /**
2257
+ * Returns a value's initial fundamental data type. Read it before the other
2258
+ * value functions, whose conversions can change it.
2259
+ *
2260
+ * Wasm type `i(i)`. Signature `["sqlite3_value_type", "int", "sqlite3_value*"]`
2261
+ * from SQLite's table.
2262
+ *
2263
+ * See https://sqlite.org/c3ref/value_blob.html.
2264
+ */
2265
+ export const sqlite3_value_type = (
2266
+ deps: SqliteWasmDep,
2267
+ ): SqliteCExports["sqlite3_value_type"] =>
2268
+ deps.sqliteWasm.exports.sqlite3_value_type;
2269
+
2270
+ /**
2271
+ * Converts a value that looks like a number to INTEGER or FLOAT when no
2272
+ * information is lost, and returns its resulting fundamental data type.
2273
+ *
2274
+ * Wasm type `i(i)`. Signature `["sqlite3_value_numeric_type", "int",
2275
+ * "sqlite3_value*"]` from SQLite's table.
2276
+ *
2277
+ * See https://sqlite.org/c3ref/value_blob.html.
2278
+ */
2279
+ export const sqlite3_value_numeric_type = (
2280
+ deps: SqliteWasmDep,
2281
+ ): SqliteCExports["sqlite3_value_numeric_type"] =>
2282
+ deps.sqliteWasm.exports.sqlite3_value_numeric_type;
2283
+
2284
+ /**
2285
+ * Returns a value as a 32-bit integer, converting other types as CAST does and
2286
+ * truncating a larger integer to its low 32 bits, and 0 for NULL.
2287
+ *
2288
+ * Wasm type `i(i)`. Signature `["sqlite3_value_int", "int", "sqlite3_value*"]`
2289
+ * from SQLite's table.
2290
+ *
2291
+ * See https://sqlite.org/c3ref/value_blob.html.
2292
+ */
2293
+ export const sqlite3_value_int = (
2294
+ deps: SqliteWasmDep,
2295
+ ): SqliteCExports["sqlite3_value_int"] =>
2296
+ deps.sqliteWasm.exports.sqlite3_value_int;
2297
+
2298
+ /**
2299
+ * Returns a value as a 64-bit integer, converting other storage classes as
2300
+ * {@link sqlite3_column_int64} does.
2301
+ *
2302
+ * Wasm type `j(i)`. Signature `["sqlite3_value_int64", "i64",
2303
+ * "sqlite3_value*"]` from SQLite's table.
2304
+ *
2305
+ * See https://sqlite.org/c3ref/value_blob.html.
2306
+ */
2307
+ export const sqlite3_value_int64 = (
2308
+ deps: SqliteWasmDep,
2309
+ ): SqliteCExports["sqlite3_value_int64"] =>
2310
+ deps.sqliteWasm.exports.sqlite3_value_int64;
2311
+
2312
+ /**
2313
+ * Returns a value as a double, converting other types as CAST does, and 0.0 for
2314
+ * NULL.
2315
+ *
2316
+ * Wasm type `d(i)`. Signature `["sqlite3_value_double", "f64",
2317
+ * "sqlite3_value*"]` from SQLite's table.
2318
+ *
2319
+ * See https://sqlite.org/c3ref/value_blob.html.
2320
+ */
2321
+ export const sqlite3_value_double = (
2322
+ deps: SqliteWasmDep,
2323
+ ): SqliteCExports["sqlite3_value_double"] =>
2324
+ deps.sqliteWasm.exports.sqlite3_value_double;
2325
+
2326
+ /**
2327
+ * Returns the address of a protected value as NUL-terminated UTF-8 text that
2328
+ * can contain NUL characters, so read its length with
2329
+ * {@link sqlite3_value_bytes} afterwards. Returns NULL for SQL NULL and when out
2330
+ * of memory, and a later call that converts the value can invalidate the text.
2331
+ *
2332
+ * Wasm type `i(i)`. Signature `["sqlite3_value_text", "*", "sqlite3_value*"]`
2333
+ * from Evolu's supplement: SQLite's build replaces it with a JavaScript proxy
2334
+ * that keeps embedded NUL characters (proxy-text-apis).
2335
+ *
2336
+ * See https://sqlite.org/c3ref/value_blob.html.
2337
+ */
2338
+ export const sqlite3_value_text = (
2339
+ deps: SqliteWasmDep,
2340
+ ): SqliteCExports["sqlite3_value_text"] =>
2341
+ deps.sqliteWasm.exports.sqlite3_value_text;
2342
+
2343
+ /**
2344
+ * Returns the address of a value's bytes, rendering a number as text, or NULL
2345
+ * for a zero-length value or SQL NULL. Call it before
2346
+ * {@link sqlite3_value_bytes}; a later text conversion invalidates the address.
2347
+ *
2348
+ * Wasm type `i(i)`. Signature `["sqlite3_value_blob", "*", "sqlite3_value*"]`
2349
+ * from SQLite's table.
2350
+ *
2351
+ * See https://sqlite.org/c3ref/value_blob.html.
2352
+ */
2353
+ export const sqlite3_value_blob = (
2354
+ deps: SqliteWasmDep,
2355
+ ): SqliteCExports["sqlite3_value_blob"] =>
2356
+ deps.sqliteWasm.exports.sqlite3_value_blob;
2357
+
2358
+ /**
2359
+ * Returns the byte length of the blob or UTF-8 text the preceding
2360
+ * {@link sqlite3_value_blob} or {@link sqlite3_value_text} call returned, without
2361
+ * the NUL terminator; 0 for NULL.
2362
+ *
2363
+ * Wasm type `i(i)`. Signature `["sqlite3_value_bytes", "int",
2364
+ * "sqlite3_value*"]` from SQLite's table.
2365
+ *
2366
+ * See https://sqlite.org/c3ref/value_blob.html.
2367
+ */
2368
+ export const sqlite3_value_bytes = (
2369
+ deps: SqliteWasmDep,
2370
+ ): SqliteCExports["sqlite3_value_bytes"] =>
2371
+ deps.sqliteWasm.exports.sqlite3_value_bytes;
2372
+
2373
+ /**
2374
+ * Returns the pointer {@link sqlite3_bind_pointer} or
2375
+ * {@link sqlite3_result_pointer} attached to a value under a type name equal to
2376
+ * zPType by strcmp, and NULL otherwise.
2377
+ *
2378
+ * Wasm type `i(ii)`. Signature `["sqlite3_value_pointer", "*",
2379
+ * "sqlite3_value*", "string:static"]` from SQLite's table.
2380
+ *
2381
+ * See https://sqlite.org/c3ref/value_blob.html.
2382
+ */
2383
+ export const sqlite3_value_pointer = (
2384
+ deps: SqliteWasmDep,
2385
+ ): SqliteCExports["sqlite3_value_pointer"] =>
2386
+ deps.sqliteWasm.exports.sqlite3_value_pointer;
2387
+
2388
+ /**
2389
+ * Returns the subtype of an application-defined function argument, as
2390
+ * {@link sqlite3_result_subtype} set it, or 0. The reading function should be
2391
+ * registered with SQLITE_SUBTYPE, or it might get 0 in corner cases.
2392
+ *
2393
+ * Wasm type `i(i)`. Signature `["sqlite3_value_subtype", "int",
2394
+ * "sqlite3_value*"]` from SQLite's table.
2395
+ *
2396
+ * See https://sqlite.org/c3ref/value_subtype.html.
2397
+ */
2398
+ export const sqlite3_value_subtype = (
2399
+ deps: SqliteWasmDep,
2400
+ ): SqliteCExports["sqlite3_value_subtype"] =>
2401
+ deps.sqliteWasm.exports.sqlite3_value_subtype;
2402
+
2403
+ /**
2404
+ * Returns non-zero when a value came from a bound parameter rather than a
2405
+ * literal, a column or an expression.
2406
+ *
2407
+ * Wasm type `i(i)`. Signature `["sqlite3_value_frombind", "int",
2408
+ * "sqlite3_value*"]` from SQLite's table.
2409
+ *
2410
+ * See https://sqlite.org/c3ref/value_blob.html.
2411
+ */
2412
+ export const sqlite3_value_frombind = (
2413
+ deps: SqliteWasmDep,
2414
+ ): SqliteCExports["sqlite3_value_frombind"] =>
2415
+ deps.sqliteWasm.exports.sqlite3_value_frombind;
2416
+
2417
+ /**
2418
+ * Within a virtual table's xUpdate, returns non-zero when the value's column is
2419
+ * unchanged by the UPDATE because xColumn set no result; such a value otherwise
2420
+ * looks like NULL. Anywhere else the result is meaningless.
2421
+ *
2422
+ * Wasm type `i(i)`. Signature `["sqlite3_value_nochange", "int",
2423
+ * "sqlite3_value*"]` from SQLite's table.
2424
+ *
2425
+ * See https://sqlite.org/c3ref/value_blob.html.
2426
+ */
2427
+ export const sqlite3_value_nochange = (
2428
+ deps: SqliteWasmDep,
2429
+ ): SqliteCExports["sqlite3_value_nochange"] =>
2430
+ deps.sqliteWasm.exports.sqlite3_value_nochange;
2431
+
2432
+ /**
2433
+ * Copies a value into a protected value the caller frees with
2434
+ * {@link sqlite3_value_free}. Returns NULL for NULL or when out of memory, and a
2435
+ * pointer value copies as SQL NULL.
2436
+ *
2437
+ * Wasm type `i(i)`. Signature `["sqlite3_value_dup", "sqlite3_value*",
2438
+ * "sqlite3_value*"]` from SQLite's table.
2439
+ *
2440
+ * See https://sqlite.org/c3ref/value_dup.html.
2441
+ */
2442
+ export const sqlite3_value_dup = (
2443
+ deps: SqliteWasmDep,
2444
+ ): SqliteCExports["sqlite3_value_dup"] =>
2445
+ deps.sqliteWasm.exports.sqlite3_value_dup;
2446
+
2447
+ /**
2448
+ * Frees a value from {@link sqlite3_value_dup}; NULL is a no-op.
2449
+ *
2450
+ * Wasm type `v(i)`. Signature `["sqlite3_value_free", undefined,
2451
+ * "sqlite3_value*"]` from SQLite's table.
2452
+ *
2453
+ * See https://sqlite.org/c3ref/value_dup.html.
2454
+ */
2455
+ export const sqlite3_value_free = (
2456
+ deps: SqliteWasmDep,
2457
+ ): SqliteCExports["sqlite3_value_free"] =>
2458
+ deps.sqliteWasm.exports.sqlite3_value_free;
2459
+
2460
+ /**
2461
+ * Adds, redefines or, with xFunc, xStep and xFinal all NULL, removes an SQL
2462
+ * function of the connection: xFunc implements a scalar function, xStep with
2463
+ * xFinal an aggregate. nArg is the argument count or -1 for any, and eTextRep
2464
+ * the preferred text encoding, optionally with flags such as
2465
+ * SQLITE_DETERMINISTIC and SQLITE_DIRECTONLY.
2466
+ *
2467
+ * Wasm type `i(iiiiiiii)`. Signature `["sqlite3_create_function", "int",
2468
+ * "sqlite3*", "string", "int", "int", "*", "funcptr:v(pip)", "funcptr:v(pip)",
2469
+ * "funcptr:v(p)"]` from Evolu's supplement: SQLite binds it by hand to accept
2470
+ * JavaScript functions as callbacks.
2471
+ *
2472
+ * See https://sqlite.org/c3ref/create_function.html.
2473
+ */
2474
+ export const sqlite3_create_function = (
2475
+ deps: SqliteWasmDep,
2476
+ ): SqliteCExports["sqlite3_create_function"] =>
2477
+ deps.sqliteWasm.exports.sqlite3_create_function;
2478
+
2479
+ /**
2480
+ * Works like {@link sqlite3_create_function}, and SQLite calls a non-NULL
2481
+ * xDestroy with pApp when the function is redefined or removed, when the
2482
+ * connection closes, and when this call fails.
2483
+ *
2484
+ * Wasm type `i(iiiiiiiii)`. Signature `["sqlite3_create_function_v2", "int",
2485
+ * "sqlite3*", "string", "int", "int", "*", "funcptr:v(pip)", "funcptr:v(pip)",
2486
+ * "funcptr:v(p)", "funcptr:v(p)"]` from Evolu's supplement: SQLite binds it by
2487
+ * hand to accept JavaScript functions as callbacks.
2488
+ *
2489
+ * See https://sqlite.org/c3ref/create_function.html.
2490
+ */
2491
+ export const sqlite3_create_function_v2 = (
2492
+ deps: SqliteWasmDep,
2493
+ ): SqliteCExports["sqlite3_create_function_v2"] =>
2494
+ deps.sqliteWasm.exports.sqlite3_create_function_v2;
2495
+
2496
+ /**
2497
+ * Ensures a global SQL function with this name and argument count exists,
2498
+ * creating a placeholder that raises an error when called, so a virtual table's
2499
+ * xFindFunction can overload it.
2500
+ *
2501
+ * Wasm type `i(iii)`. Signature `["sqlite3_overload_function", "int",
2502
+ * "sqlite3*", "string", "int"]` from SQLite's table.
2503
+ *
2504
+ * See https://sqlite.org/c3ref/overload_function.html.
2505
+ */
2506
+ export const sqlite3_overload_function = (
2507
+ deps: SqliteWasmDep,
2508
+ ): SqliteCExports["sqlite3_overload_function"] =>
2509
+ deps.sqliteWasm.exports.sqlite3_overload_function;
2510
+
2511
+ /**
2512
+ * Adds, replaces or, with a NULL xCompare, removes a collation named zName for
2513
+ * text in the eTextRep encoding. `xCompare(pArg, n1, s1, n2, s2)` compares two
2514
+ * strings of the given byte lengths and returns a negative number, zero or a
2515
+ * positive number; SQLite behavior is undefined when the comparison is
2516
+ * inconsistent.
2517
+ *
2518
+ * Wasm type `i(iiiii)`. Signature `["sqlite3_create_collation", "int",
2519
+ * "sqlite3*", "string", "int", "*", "funcptr:i(pipip)"]` from Evolu's
2520
+ * supplement: SQLite binds it by hand to accept JavaScript functions as
2521
+ * callbacks.
2522
+ *
2523
+ * See https://sqlite.org/c3ref/create_collation.html.
2524
+ */
2525
+ export const sqlite3_create_collation = (
2526
+ deps: SqliteWasmDep,
2527
+ ): SqliteCExports["sqlite3_create_collation"] =>
2528
+ deps.sqliteWasm.exports.sqlite3_create_collation;
2529
+
2530
+ /**
2531
+ * Works like {@link sqlite3_create_collation}, and SQLite calls a non-NULL
2532
+ * xDestroy with pArg when the collation is replaced or the connection closes.
2533
+ * Unlike other SQLite functions, it does not call xDestroy when this call
2534
+ * fails, so the caller then disposes of pArg.
2535
+ *
2536
+ * Wasm type `i(iiiiii)`. Signature `["sqlite3_create_collation_v2", "int",
2537
+ * "sqlite3*", "string", "int", "*", "funcptr:i(pipip)", "funcptr:v(p)"]` from
2538
+ * Evolu's supplement: SQLite binds it by hand to accept JavaScript functions as
2539
+ * callbacks.
2540
+ *
2541
+ * See https://sqlite.org/c3ref/create_collation.html.
2542
+ */
2543
+ export const sqlite3_create_collation_v2 = (
2544
+ deps: SqliteWasmDep,
2545
+ ): SqliteCExports["sqlite3_create_collation_v2"] =>
2546
+ deps.sqliteWasm.exports.sqlite3_create_collation_v2;
2547
+
2548
+ /**
2549
+ * Returns the user data pointer the running application-defined function was
2550
+ * registered with.
2551
+ *
2552
+ * Wasm type `i(i)`. Signature `["sqlite3_user_data", "void*",
2553
+ * "sqlite3_context*"]` from SQLite's table.
2554
+ *
2555
+ * See https://sqlite.org/c3ref/user_data.html.
2556
+ */
2557
+ export const sqlite3_user_data = (
2558
+ deps: SqliteWasmDep,
2559
+ ): SqliteCExports["sqlite3_user_data"] =>
2560
+ deps.sqliteWasm.exports.sqlite3_user_data;
2561
+
2562
+ /**
2563
+ * Returns the connection that registered the application-defined function being
2564
+ * called.
2565
+ *
2566
+ * Wasm type `i(i)`. Signature `["sqlite3_context_db_handle", "sqlite3*",
2567
+ * "sqlite3_context*"]` from SQLite's table.
2568
+ *
2569
+ * See https://sqlite.org/c3ref/context_db_handle.html.
2570
+ */
2571
+ export const sqlite3_context_db_handle = (
2572
+ deps: SqliteWasmDep,
2573
+ ): SqliteCExports["sqlite3_context_db_handle"] =>
2574
+ deps.sqliteWasm.exports.sqlite3_context_db_handle;
2575
+
2576
+ /**
2577
+ * Returns the state memory of the current aggregate function instance: the
2578
+ * first call allocates nBytes of zeroed memory, later calls return the same
2579
+ * buffer, and SQLite frees it when the aggregate concludes. Returns NULL when
2580
+ * the first call passes nBytes of zero or less or runs out of memory.
2581
+ *
2582
+ * Wasm type `i(ii)`. Signature `["sqlite3_aggregate_context", "void*",
2583
+ * "sqlite3_context*", "int"]` from SQLite's table.
2584
+ *
2585
+ * See https://sqlite.org/c3ref/aggregate_context.html.
2586
+ */
2587
+ export const sqlite3_aggregate_context = (
2588
+ deps: SqliteWasmDep,
2589
+ ): SqliteCExports["sqlite3_aggregate_context"] =>
2590
+ deps.sqliteWasm.exports.sqlite3_aggregate_context;
2591
+
2592
+ /**
2593
+ * Returns the auxiliary data {@link sqlite3_set_auxdata} associated with the
2594
+ * 0-based N-th argument of the current function call, or NULL when there is
2595
+ * none or SQLite discarded it.
2596
+ *
2597
+ * Wasm type `i(ii)`. Signature `["sqlite3_get_auxdata", "*",
2598
+ * "sqlite3_context*", "int"]` from SQLite's table.
2599
+ *
2600
+ * See https://sqlite.org/c3ref/get_auxdata.html.
2601
+ */
2602
+ export const sqlite3_get_auxdata = (
2603
+ deps: SqliteWasmDep,
2604
+ ): SqliteCExports["sqlite3_get_auxdata"] =>
2605
+ deps.sqliteWasm.exports.sqlite3_get_auxdata;
2606
+
2607
+ /**
2608
+ * Attaches pAux to the N-th argument of the running application-defined
2609
+ * function, where {@link sqlite3_get_auxdata} finds it while the argument stays
2610
+ * the same. SQLite may discard it at any time, even before this call returns,
2611
+ * calling a non-NULL xDelete with pAux, so pAux must not be used afterwards.
2612
+ *
2613
+ * Wasm type `v(iiii)`. Signature `["sqlite3_set_auxdata", undefined,
2614
+ * "sqlite3_context*", "int", "*", "*"]` from SQLite's table.
2615
+ *
2616
+ * See https://sqlite.org/c3ref/get_auxdata.html.
2617
+ */
2618
+ export const sqlite3_set_auxdata = (
2619
+ deps: SqliteWasmDep,
2620
+ ): SqliteCExports["sqlite3_set_auxdata"] =>
2621
+ deps.sqliteWasm.exports.sqlite3_set_auxdata;
2622
+
2623
+ /**
2624
+ * Sets an application-defined function's result to NULL.
2625
+ *
2626
+ * Wasm type `v(i)`. Signature `["sqlite3_result_null", undefined,
2627
+ * "sqlite3_context*"]` from SQLite's table.
2628
+ *
2629
+ * See https://sqlite.org/c3ref/result_blob.html.
2630
+ */
2631
+ export const sqlite3_result_null = (
2632
+ deps: SqliteWasmDep,
2633
+ ): SqliteCExports["sqlite3_result_null"] =>
2634
+ deps.sqliteWasm.exports.sqlite3_result_null;
2635
+
2636
+ /**
2637
+ * Sets an application-defined function's result to a 32-bit integer. The wasm
2638
+ * boundary converts the number with ToInt32, so a fraction is truncated and a
2639
+ * value outside the int32 range wraps silently.
2640
+ *
2641
+ * Wasm type `v(ii)`. Signature `["sqlite3_result_int", undefined,
2642
+ * "sqlite3_context*", "int"]` from SQLite's table.
2643
+ *
2644
+ * See https://sqlite.org/c3ref/result_blob.html.
2645
+ */
2646
+ export const sqlite3_result_int = (
2647
+ deps: SqliteWasmDep,
2648
+ ): SqliteCExports["sqlite3_result_int"] =>
2649
+ deps.sqliteWasm.exports.sqlite3_result_int;
2650
+
2651
+ /**
2652
+ * Sets an application-defined function's result to a 64-bit integer. The wasm
2653
+ * boundary wraps a bigint outside the int64 range silently.
2654
+ *
2655
+ * Wasm type `v(ij)`. Signature `["sqlite3_result_int64", undefined, "*",
2656
+ * "i64"]` from SQLite's table.
2657
+ *
2658
+ * See https://sqlite.org/c3ref/result_blob.html.
2659
+ */
2660
+ export const sqlite3_result_int64 = (
2661
+ deps: SqliteWasmDep,
2662
+ ): SqliteCExports["sqlite3_result_int64"] =>
2663
+ deps.sqliteWasm.exports.sqlite3_result_int64;
2664
+
2665
+ /**
2666
+ * Sets an application-defined function's result to a double; SQLite stores NaN
2667
+ * as NULL.
2668
+ *
2669
+ * Wasm type `v(id)`. Signature `["sqlite3_result_double", undefined,
2670
+ * "sqlite3_context*", "f64"]` from SQLite's table.
2671
+ *
2672
+ * See https://sqlite.org/c3ref/result_blob.html.
2673
+ */
2674
+ export const sqlite3_result_double = (
2675
+ deps: SqliteWasmDep,
2676
+ ): SqliteCExports["sqlite3_result_double"] =>
2677
+ deps.sqliteWasm.exports.sqlite3_result_double;
2678
+
2679
+ /**
2680
+ * Sets an application-defined function's result to UTF-8 text of n bytes, or up
2681
+ * to its NUL terminator when n is negative. A NULL address sets SQL NULL, as
2682
+ * for {@link sqlite3_bind_text}.
2683
+ *
2684
+ * Wasm type `v(iiii)`. Signature `["sqlite3_result_text", undefined,
2685
+ * "sqlite3_context*", "string", "int", "*"]` from SQLite's table.
2686
+ *
2687
+ * See https://sqlite.org/c3ref/result_blob.html.
2688
+ */
2689
+ export const sqlite3_result_text = (
2690
+ deps: SqliteWasmDep,
2691
+ ): SqliteCExports["sqlite3_result_text"] =>
2692
+ deps.sqliteWasm.exports.sqlite3_result_text;
2693
+
2694
+ /**
2695
+ * Sets an application-defined function's result to n bytes. A NULL address sets
2696
+ * SQL NULL, as for {@link sqlite3_bind_blob}, so an empty blob needs a non-NULL
2697
+ * address or {@link sqlite3_result_zeroblob}.
2698
+ *
2699
+ * Wasm type `v(iiii)`. Signature `["sqlite3_result_blob", undefined,
2700
+ * "sqlite3_context*", "*", "int", "*"]` from SQLite's table.
2701
+ *
2702
+ * See https://sqlite.org/c3ref/result_blob.html.
2703
+ */
2704
+ export const sqlite3_result_blob = (
2705
+ deps: SqliteWasmDep,
2706
+ ): SqliteCExports["sqlite3_result_blob"] =>
2707
+ deps.sqliteWasm.exports.sqlite3_result_blob;
2708
+
2709
+ /**
2710
+ * Sets an application-defined function's result to a blob of n zero bytes, 0
2711
+ * for a negative n. A size beyond SQLITE_LIMIT_LENGTH makes the function fail
2712
+ * with SQLITE_TOOBIG.
2713
+ *
2714
+ * Wasm type `v(ii)`. Signature `["sqlite3_result_zeroblob", undefined,
2715
+ * "sqlite3_context*", "int"]` from SQLite's table.
2716
+ *
2717
+ * See https://sqlite.org/c3ref/result_blob.html.
2718
+ */
2719
+ export const sqlite3_result_zeroblob = (
2720
+ deps: SqliteWasmDep,
2721
+ ): SqliteCExports["sqlite3_result_zeroblob"] =>
2722
+ deps.sqliteWasm.exports.sqlite3_result_zeroblob;
2723
+
2724
+ /**
2725
+ * Sets an application-defined function's result to a blob of n zero bytes.
2726
+ * Returns SQLITE_TOOBIG, and makes the function fail with that error, when n
2727
+ * exceeds the connection's length limit.
2728
+ *
2729
+ * Wasm type `i(ij)`. Signature `["sqlite3_result_zeroblob64", "int", "*",
2730
+ * "i64"]` from SQLite's table.
2731
+ *
2732
+ * See https://sqlite.org/c3ref/result_blob.html.
2733
+ */
2734
+ export const sqlite3_result_zeroblob64 = (
2735
+ deps: SqliteWasmDep,
2736
+ ): SqliteCExports["sqlite3_result_zeroblob64"] =>
2737
+ deps.sqliteWasm.exports.sqlite3_result_zeroblob64;
2738
+
2739
+ /**
2740
+ * Sets an application-defined function's result to an SQL NULL carrying pPtr,
2741
+ * which {@link sqlite3_value_pointer} returns for an equal type name. SQLite
2742
+ * keeps zPType itself, so it must outlive the value, and calls a non-NULL
2743
+ * xDestructor with pPtr when done with it.
2744
+ *
2745
+ * Wasm type `v(iiii)`. Signature `["sqlite3_result_pointer", undefined,
2746
+ * "sqlite3_context*", "*", "string:static", "*"]` from SQLite's table.
2747
+ *
2748
+ * See https://sqlite.org/c3ref/result_blob.html.
2749
+ */
2750
+ export const sqlite3_result_pointer = (
2751
+ deps: SqliteWasmDep,
2752
+ ): SqliteCExports["sqlite3_result_pointer"] =>
2753
+ deps.sqliteWasm.exports.sqlite3_result_pointer;
2754
+
2755
+ /**
2756
+ * Sets the subtype of an application-defined function's result, keeping only
2757
+ * its low 8 bits. The function must be registered with SQLITE_RESULT_SUBTYPE:
2758
+ * without it the subtype might not be set, and a build with
2759
+ * SQLITE_STRICT_SUBTYPE, such as this one, fails the function with an error.
2760
+ * SQLite's table declares the first parameter as sqlite3_value*, but the C
2761
+ * function takes sqlite3_context*.
2762
+ *
2763
+ * Wasm type `v(ii)`. Signature `["sqlite3_result_subtype", undefined,
2764
+ * "sqlite3_value*", "int"]` from SQLite's table.
2765
+ *
2766
+ * See https://sqlite.org/c3ref/result_subtype.html.
2767
+ */
2768
+ export const sqlite3_result_subtype = (
2769
+ deps: SqliteWasmDep,
2770
+ ): SqliteCExports["sqlite3_result_subtype"] =>
2771
+ deps.sqliteWasm.exports.sqlite3_result_subtype;
2772
+
2773
+ /**
2774
+ * Makes an application-defined function fail with a copy of a UTF-8 message of
2775
+ * n bytes, or up to its NUL terminator when n is negative. It resets the error
2776
+ * code to SQLITE_ERROR, so call {@link sqlite3_result_error_code} after it.
2777
+ *
2778
+ * Wasm type `v(iii)`. Signature `["sqlite3_result_error", undefined,
2779
+ * "sqlite3_context*", "string", "int"]` from SQLite's table.
2780
+ *
2781
+ * See https://sqlite.org/c3ref/result_blob.html.
2782
+ */
2783
+ export const sqlite3_result_error = (
2784
+ deps: SqliteWasmDep,
2785
+ ): SqliteCExports["sqlite3_result_error"] =>
2786
+ deps.sqliteWasm.exports.sqlite3_result_error;
2787
+
2788
+ /**
2789
+ * Makes an application-defined function fail with a result code instead of
2790
+ * SQLITE_ERROR, and with the code's default message when no result was set.
2791
+ * Call it after {@link sqlite3_result_error}, which resets the code to
2792
+ * SQLITE_ERROR.
2793
+ *
2794
+ * Wasm type `v(ii)`. Signature `["sqlite3_result_error_code", undefined,
2795
+ * "sqlite3_context*", "int"]` from SQLite's table.
2796
+ *
2797
+ * See https://sqlite.org/c3ref/result_blob.html.
2798
+ */
2799
+ export const sqlite3_result_error_code = (
2800
+ deps: SqliteWasmDep,
2801
+ ): SqliteCExports["sqlite3_result_error_code"] =>
2802
+ deps.sqliteWasm.exports.sqlite3_result_error_code;
2803
+
2804
+ /**
2805
+ * Makes an application-defined function fail with SQLITE_NOMEM, as a failed
2806
+ * memory allocation would.
2807
+ *
2808
+ * Wasm type `v(i)`. Signature `["sqlite3_result_error_nomem", undefined,
2809
+ * "sqlite3_context*"]` from SQLite's table.
2810
+ *
2811
+ * See https://sqlite.org/c3ref/result_blob.html.
2812
+ */
2813
+ export const sqlite3_result_error_nomem = (
2814
+ deps: SqliteWasmDep,
2815
+ ): SqliteCExports["sqlite3_result_error_nomem"] =>
2816
+ deps.sqliteWasm.exports.sqlite3_result_error_nomem;
2817
+
2818
+ /**
2819
+ * Makes an application-defined function fail with SQLITE_TOOBIG, reporting a
2820
+ * string or blob too big to represent.
2821
+ *
2822
+ * Wasm type `v(i)`. Signature `["sqlite3_result_error_toobig", undefined,
2823
+ * "sqlite3_context*"]` from SQLite's table.
2824
+ *
2825
+ * See https://sqlite.org/c3ref/result_blob.html.
2826
+ */
2827
+ export const sqlite3_result_error_toobig = (
2828
+ deps: SqliteWasmDep,
2829
+ ): SqliteCExports["sqlite3_result_error_toobig"] =>
2830
+ deps.sqliteWasm.exports.sqlite3_result_error_toobig;
2831
+
2832
+ /**
2833
+ * Returns the value of a URI query parameter of a filename, an empty string for
2834
+ * a parameter without a value, or NULL when it is absent or the filename is
2835
+ * NULL.
2836
+ *
2837
+ * Wasm type `i(ii)`. Signature `["sqlite3_uri_parameter", "string",
2838
+ * "sqlite3_filename", "string"]` from SQLite's table.
2839
+ *
2840
+ * See https://sqlite.org/c3ref/uri_boolean.html.
2841
+ */
2842
+ export const sqlite3_uri_parameter = (
2843
+ deps: SqliteWasmDep,
2844
+ ): SqliteCExports["sqlite3_uri_parameter"] =>
2845
+ deps.sqliteWasm.exports.sqlite3_uri_parameter;
2846
+
2847
+ /**
2848
+ * Returns 1 when a filename's URI query parameter is yes, true or on in any
2849
+ * case or starts with a non-zero number, 0 when it is no, false or off or
2850
+ * starts with zero, and whether bDefault is non-zero otherwise, including for a
2851
+ * NULL filename.
2852
+ *
2853
+ * Wasm type `i(iii)`. Signature `["sqlite3_uri_boolean", "int",
2854
+ * "sqlite3_filename", "string", "int"]` from SQLite's table.
2855
+ *
2856
+ * See https://sqlite.org/c3ref/uri_boolean.html.
2857
+ */
2858
+ export const sqlite3_uri_boolean = (
2859
+ deps: SqliteWasmDep,
2860
+ ): SqliteCExports["sqlite3_uri_boolean"] =>
2861
+ deps.sqliteWasm.exports.sqlite3_uri_boolean;
2862
+
2863
+ /**
2864
+ * Returns a URI query parameter of a filename SQLite created as a 64-bit
2865
+ * integer, or iDefault when the filename is NULL or the parameter is missing or
2866
+ * not a decimal or hexadecimal integer.
2867
+ *
2868
+ * Wasm type `j(iij)`. Signature `["sqlite3_uri_int64", "i64",
2869
+ * "sqlite3_filename", "string", "i64"]` from SQLite's table.
2870
+ *
2871
+ * See https://sqlite.org/c3ref/uri_boolean.html.
2872
+ */
2873
+ export const sqlite3_uri_int64 = (
2874
+ deps: SqliteWasmDep,
2875
+ ): SqliteCExports["sqlite3_uri_int64"] =>
2876
+ deps.sqliteWasm.exports.sqlite3_uri_int64;
2877
+
2878
+ /**
2879
+ * Returns the name of a filename's N-th URI query parameter, counting from 0,
2880
+ * or NULL when N is out of range.
2881
+ *
2882
+ * Wasm type `i(ii)`. Signature `["sqlite3_uri_key", "string",
2883
+ * "sqlite3_filename", "int"]` from SQLite's table.
2884
+ *
2885
+ * See https://sqlite.org/c3ref/uri_boolean.html.
2886
+ */
2887
+ export const sqlite3_uri_key = (
2888
+ deps: SqliteWasmDep,
2889
+ ): SqliteCExports["sqlite3_uri_key"] => deps.sqliteWasm.exports.sqlite3_uri_key;
2890
+
2891
+ /**
2892
+ * Returns a registered VFS by name, or the default VFS for NULL.
2893
+ *
2894
+ * Wasm type `i(i)`. Signature `["sqlite3_vfs_find", "*", "string"]` from
2895
+ * SQLite's table.
2896
+ *
2897
+ * See https://sqlite.org/c3ref/vfs_find.html.
2898
+ */
2899
+ export const sqlite3_vfs_find = (
2900
+ deps: SqliteWasmDep,
2901
+ ): SqliteCExports["sqlite3_vfs_find"] =>
2902
+ deps.sqliteWasm.exports.sqlite3_vfs_find;
2903
+
2904
+ /**
2905
+ * Registers a VFS, optionally as the default. The struct and its name must
2906
+ * outlive the registration.
2907
+ *
2908
+ * Wasm type `i(ii)`. Signature `["sqlite3_vfs_register", "int", "sqlite3_vfs*",
2909
+ * "int"]` from SQLite's table.
2910
+ *
2911
+ * See https://sqlite.org/c3ref/vfs_find.html.
2912
+ */
2913
+ export const sqlite3_vfs_register = (
2914
+ deps: SqliteWasmDep,
2915
+ ): SqliteCExports["sqlite3_vfs_register"] =>
2916
+ deps.sqliteWasm.exports.sqlite3_vfs_register;
2917
+
2918
+ /**
2919
+ * Unregisters a VFS. When it was the default, SQLite makes an arbitrary other
2920
+ * VFS the default.
2921
+ *
2922
+ * Wasm type `i(i)`. Signature `["sqlite3_vfs_unregister", "int",
2923
+ * "sqlite3_vfs*"]` from SQLite's table.
2924
+ *
2925
+ * See https://sqlite.org/c3ref/vfs_find.html.
2926
+ */
2927
+ export const sqlite3_vfs_unregister = (
2928
+ deps: SqliteWasmDep,
2929
+ ): SqliteCExports["sqlite3_vfs_unregister"] =>
2930
+ deps.sqliteWasm.exports.sqlite3_vfs_unregister;
2931
+
2932
+ /**
2933
+ * Returns the ON CONFLICT mode of the statement that called xUpdate for an
2934
+ * INSERT or UPDATE: SQLITE_ROLLBACK, SQLITE_IGNORE, SQLITE_FAIL, SQLITE_ABORT
2935
+ * or SQLITE_REPLACE. Only xUpdate may call it.
2936
+ *
2937
+ * Wasm type `i(i)`. Signature `["sqlite3_vtab_on_conflict", "int", "sqlite3*"]`
2938
+ * from SQLite's table.
2939
+ *
2940
+ * See https://sqlite.org/c3ref/vtab_on_conflict.html.
2941
+ */
2942
+ export const sqlite3_vtab_on_conflict = (
2943
+ deps: SqliteWasmDep,
2944
+ ): SqliteCExports["sqlite3_vtab_on_conflict"] =>
2945
+ deps.sqliteWasm.exports.sqlite3_vtab_on_conflict;
2946
+
2947
+ /**
2948
+ * Returns non-zero inside xColumn when the column is fetched for an UPDATE that
2949
+ * does not change it, so xColumn may leave the result unset. It is only a hint
2950
+ * and may always return 0.
2951
+ *
2952
+ * Wasm type `i(i)`. Signature `["sqlite3_vtab_nochange", "int",
2953
+ * "sqlite3_context*"]` from SQLite's table.
2954
+ *
2955
+ * See https://sqlite.org/c3ref/vtab_nochange.html.
2956
+ */
2957
+ export const sqlite3_vtab_nochange = (
2958
+ deps: SqliteWasmDep,
2959
+ ): SqliteCExports["sqlite3_vtab_nochange"] =>
2960
+ deps.sqliteWasm.exports.sqlite3_vtab_nochange;
2961
+
2962
+ /**
2963
+ * Returns the collation name for text comparisons of an xBestIndex constraint,
2964
+ * `BINARY` by default, or NULL for an index outside aConstraint. Only
2965
+ * xBestIndex may call it, with the sqlite3_index_info it received.
2966
+ *
2967
+ * Wasm type `i(ii)`. Signature `["sqlite3_vtab_collation", "string",
2968
+ * "sqlite3_index_info*", "int"]` from SQLite's table.
2969
+ *
2970
+ * See https://sqlite.org/c3ref/vtab_collation.html.
2971
+ */
2972
+ export const sqlite3_vtab_collation = (
2973
+ deps: SqliteWasmDep,
2974
+ ): SqliteCExports["sqlite3_vtab_collation"] =>
2975
+ deps.sqliteWasm.exports.sqlite3_vtab_collation;
2976
+
2977
+ /**
2978
+ * Returns how the planner needs a virtual table's rows for orderByConsumed: 0
2979
+ * in aOrderBy order, 1 with equal aOrderBy values adjacent, 2 adjacent with
2980
+ * duplicates over colUsed omittable, 3 in order with such duplicates omittable.
2981
+ * Only xBestIndex may call it.
2982
+ *
2983
+ * Wasm type `i(i)`. Signature `["sqlite3_vtab_distinct", "int",
2984
+ * "sqlite3_index_info*"]` from SQLite's table.
2985
+ *
2986
+ * See https://sqlite.org/c3ref/vtab_distinct.html.
2987
+ */
2988
+ export const sqlite3_vtab_distinct = (
2989
+ deps: SqliteWasmDep,
2990
+ ): SqliteCExports["sqlite3_vtab_distinct"] =>
2991
+ deps.sqliteWasm.exports.sqlite3_vtab_distinct;
2992
+
2993
+ /**
2994
+ * Returns non-zero when constraint iCons is an IN operator that can be
2995
+ * processed all at once; bHandle 1 or 0 requests or declines that processing,
2996
+ * and -1 only asks. Only xBestIndex may call it.
2997
+ *
2998
+ * Wasm type `i(iii)`. Signature `["sqlite3_vtab_in", "int",
2999
+ * "sqlite3_index_info*", "int", "int"]` from SQLite's table.
3000
+ *
3001
+ * See https://sqlite.org/c3ref/vtab_in.html.
3002
+ */
3003
+ export const sqlite3_vtab_in = (
3004
+ deps: SqliteWasmDep,
3005
+ ): SqliteCExports["sqlite3_vtab_in"] => deps.sqliteWasm.exports.sqlite3_vtab_in;
3006
+
3007
+ /**
3008
+ * Writes the first right-hand value of an all-at-once IN constraint, given its
3009
+ * xFilter argument, to ppOut and returns SQLITE_OK, or writes NULL and returns
3010
+ * SQLITE_DONE when there is none. The value stays valid until the next call or
3011
+ * the end of xFilter.
3012
+ *
3013
+ * Wasm type `i(ii)`. Signature `["sqlite3_vtab_in_first", "int",
3014
+ * "sqlite3_value*", "**"]` from SQLite's table.
3015
+ *
3016
+ * See https://sqlite.org/c3ref/vtab_in_first.html.
3017
+ */
3018
+ export const sqlite3_vtab_in_first = (
3019
+ deps: SqliteWasmDep,
3020
+ ): SqliteCExports["sqlite3_vtab_in_first"] =>
3021
+ deps.sqliteWasm.exports.sqlite3_vtab_in_first;
3022
+
3023
+ /**
3024
+ * Writes the next right-hand value of an all-at-once IN constraint, given its
3025
+ * xFilter argument, to ppOut and returns SQLITE_OK, or writes NULL and returns
3026
+ * SQLITE_DONE after the last. The value stays valid until the next call or the
3027
+ * end of xFilter.
3028
+ *
3029
+ * Wasm type `i(ii)`. Signature `["sqlite3_vtab_in_next", "int",
3030
+ * "sqlite3_value*", "**"]` from SQLite's table.
3031
+ *
3032
+ * See https://sqlite.org/c3ref/vtab_in_first.html.
3033
+ */
3034
+ export const sqlite3_vtab_in_next = (
3035
+ deps: SqliteWasmDep,
3036
+ ): SqliteCExports["sqlite3_vtab_in_next"] =>
3037
+ deps.sqliteWasm.exports.sqlite3_vtab_in_next;
3038
+
3039
+ /**
3040
+ * Writes the right-hand value of constraint iCons to ppVal and returns
3041
+ * SQLITE_OK, or writes NULL and returns SQLITE_NOTFOUND when it is not known,
3042
+ * which is usual unless it is a literal. Only xBestIndex may call it, and the
3043
+ * value is freed when xBestIndex returns.
3044
+ *
3045
+ * Wasm type `i(iii)`. Signature `["sqlite3_vtab_rhs_value", "int",
3046
+ * "sqlite3_index_info*", "int", "**"]` from SQLite's table.
3047
+ *
3048
+ * See https://sqlite.org/c3ref/vtab_rhs_value.html.
3049
+ */
3050
+ export const sqlite3_vtab_rhs_value = (
3051
+ deps: SqliteWasmDep,
3052
+ ): SqliteCExports["sqlite3_vtab_rhs_value"] =>
3053
+ deps.sqliteWasm.exports.sqlite3_vtab_rhs_value;
3054
+
3055
+ /** An option of {@link sqlite3_config} that takes one int. */
3056
+ export type SqliteConfigIntOp =
3057
+ | typeof SQLITE_CONFIG_MEMSTATUS
3058
+ | typeof SQLITE_CONFIG_URI
3059
+ | typeof SQLITE_CONFIG_COVERING_INDEX_SCAN
3060
+ | typeof SQLITE_CONFIG_STMTJRNL_SPILL
3061
+ | typeof SQLITE_CONFIG_SMALL_MALLOC
3062
+ | typeof SQLITE_CONFIG_SORTERREF_SIZE;
3063
+
3064
+ /** An option of {@link sqlite3_config} and the arguments it takes. */
3065
+ export type SqliteConfigArgs =
3066
+ | readonly [op: SqliteConfigIntOp, value: number]
3067
+ | readonly [op: typeof SQLITE_CONFIG_LOOKASIDE, sz: number, cnt: number]
3068
+ | readonly [op: typeof SQLITE_CONFIG_MEMDB_MAXSIZE, value: bigint];
3069
+
3070
+ /**
3071
+ * Changes a global option of the library, which works only before
3072
+ * {@link sqlite3_initialize} or after {@link sqlite3_shutdown} and otherwise
3073
+ * returns SQLITE_MISUSE. The loader initializes the library, so call it after
3074
+ * sqlite3_shutdown, then initialize the library again with
3075
+ * initializeSqliteWasm, as sqlite3_shutdown explains.
3076
+ *
3077
+ * - SQLITE_CONFIG_MEMSTATUS, SQLITE_CONFIG_SMALL_MALLOC, SQLITE_CONFIG_URI and
3078
+ * SQLITE_CONFIG_COVERING_INDEX_SCAN turn a feature on for a non-zero value
3079
+ * and off for 0.
3080
+ * - SQLITE_CONFIG_STMTJRNL_SPILL sets the byte size above which statement
3081
+ * journals spill to disk. SQLITE_CONFIG_SORTERREF_SIZE fails with
3082
+ * SQLITE_ERROR, since this build does not enable sorter references.
3083
+ * - SQLITE_CONFIG_LOOKASIDE sets the default lookaside allocator of new
3084
+ * connections to cnt slots of sz bytes.
3085
+ * - SQLITE_CONFIG_MEMDB_MAXSIZE sets the default maximum size of a database
3086
+ * {@link sqlite3_deserialize} creates.
3087
+ *
3088
+ * The C function is variadic, so the binary does not export it. This calls the
3089
+ * build's shim for the option's arguments and, as SQLite's JavaScript does,
3090
+ * returns SQLITE_NOTFOUND for every other option without calling wasm, because
3091
+ * the shims pass their arguments to the C function unchecked.
3092
+ *
3093
+ * Calls the build's shims, whose signatures come from Evolu's metadata because
3094
+ * SQLite's table omits them:
3095
+ *
3096
+ * - `sqlite3__wasm_config_i`, wasm type `i(ii)`, signature
3097
+ * `["sqlite3__wasm_config_i", "int", "int", "int"]`.
3098
+ * - `sqlite3__wasm_config_ii`, wasm type `i(iii)`, signature
3099
+ * `["sqlite3__wasm_config_ii", "int", "int", "int", "int"]`.
3100
+ * - `sqlite3__wasm_config_j`, wasm type `i(ij)`, signature
3101
+ * `["sqlite3__wasm_config_j", "int", "int", "i64"]`.
3102
+ *
3103
+ * See https://sqlite.org/c3ref/config.html.
3104
+ */
3105
+ export const sqlite3_config = (
3106
+ deps: SqliteWasmDep,
3107
+ ): ((...args: SqliteConfigArgs) => SqliteResultCode) => {
3108
+ const {
3109
+ sqlite3__wasm_config_i,
3110
+ sqlite3__wasm_config_ii,
3111
+ sqlite3__wasm_config_j,
3112
+ } = deps.sqliteWasm.exports;
3113
+ return (...args) => {
3114
+ switch (args[0]) {
3115
+ case SQLITE_CONFIG_MEMSTATUS:
3116
+ case SQLITE_CONFIG_URI:
3117
+ case SQLITE_CONFIG_COVERING_INDEX_SCAN:
3118
+ case SQLITE_CONFIG_STMTJRNL_SPILL:
3119
+ case SQLITE_CONFIG_SMALL_MALLOC:
3120
+ case SQLITE_CONFIG_SORTERREF_SIZE:
3121
+ return sqlite3__wasm_config_i(args[0], args[1]);
3122
+ case SQLITE_CONFIG_LOOKASIDE:
3123
+ return sqlite3__wasm_config_ii(args[0], args[1], args[2]);
3124
+ case SQLITE_CONFIG_MEMDB_MAXSIZE:
3125
+ return sqlite3__wasm_config_j(args[0], args[1]);
3126
+ default:
3127
+ // TypeScript rejects other options, but JavaScript and casts can pass
3128
+ // them.
3129
+ return SQLITE_NOTFOUND;
3130
+ }
3131
+ };
3132
+ };
3133
+
3134
+ /**
3135
+ * An option of {@link sqlite3_db_config} that takes an int and an `int*`: a
3136
+ * flag, or SQLITE_DBCONFIG_FP_DIGITS.
3137
+ */
3138
+ export type SqliteDbConfigIntOp =
3139
+ | typeof SQLITE_DBCONFIG_ENABLE_FKEY
3140
+ | typeof SQLITE_DBCONFIG_ENABLE_TRIGGER
3141
+ | typeof SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
3142
+ | typeof SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
3143
+ | typeof SQLITE_DBCONFIG_ENABLE_QPSG
3144
+ | typeof SQLITE_DBCONFIG_TRIGGER_EQP
3145
+ | typeof SQLITE_DBCONFIG_RESET_DATABASE
3146
+ | typeof SQLITE_DBCONFIG_DEFENSIVE
3147
+ | typeof SQLITE_DBCONFIG_WRITABLE_SCHEMA
3148
+ | typeof SQLITE_DBCONFIG_LEGACY_ALTER_TABLE
3149
+ | typeof SQLITE_DBCONFIG_DQS_DML
3150
+ | typeof SQLITE_DBCONFIG_DQS_DDL
3151
+ | typeof SQLITE_DBCONFIG_ENABLE_VIEW
3152
+ | typeof SQLITE_DBCONFIG_LEGACY_FILE_FORMAT
3153
+ | typeof SQLITE_DBCONFIG_TRUSTED_SCHEMA
3154
+ | typeof SQLITE_DBCONFIG_STMT_SCANSTATUS
3155
+ | typeof SQLITE_DBCONFIG_REVERSE_SCANORDER
3156
+ | typeof SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE
3157
+ | typeof SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE
3158
+ | typeof SQLITE_DBCONFIG_ENABLE_COMMENTS
3159
+ | typeof SQLITE_DBCONFIG_FP_DIGITS;
3160
+
3161
+ /** An option of {@link sqlite3_db_config} and the arguments it takes. */
3162
+ export type SqliteDbConfigArgs =
3163
+ | readonly [op: typeof SQLITE_DBCONFIG_MAINDBNAME, zName: CStringPtr]
3164
+ | readonly [
3165
+ op: typeof SQLITE_DBCONFIG_LOOKASIDE,
3166
+ buf: WasmPtr | NullPtr,
3167
+ sz: number,
3168
+ cnt: number,
3169
+ ]
3170
+ | readonly [
3171
+ op: SqliteDbConfigIntOp,
3172
+ value: number,
3173
+ pResult?: WasmPtr | NullPtr,
3174
+ ];
3175
+
3176
+ /**
3177
+ * Changes or reads an option of a connection, returning SQLITE_OK or an error
3178
+ * code.
3179
+ *
3180
+ * - SQLITE_DBCONFIG_MAINDBNAME renames the main schema to zName, which SQLite
3181
+ * does not copy, so it must stay unchanged until the connection closes.
3182
+ * - SQLITE_DBCONFIG_LOOKASIDE sets the connection's lookaside allocator to cnt
3183
+ * slots of sz bytes in buf, which must be 8-byte aligned and hold sz times
3184
+ * cnt bytes, or in memory SQLite allocates for a NULL buf. It fails with
3185
+ * SQLITE_BUSY while lookaside memory is in use.
3186
+ * - SQLITE_DBCONFIG_FP_DIGITS sets the significant digits of floating-point to
3187
+ * text conversion to value when it is from 4 to 23, leaving the setting
3188
+ * unchanged otherwise, and writes the resulting setting to the int at pResult
3189
+ * unless it is NULL.
3190
+ * - Every other option is a flag: a positive value sets it, 0 clears it and a
3191
+ * negative value only reads it, and the resulting 0 or 1 is written to the
3192
+ * int at pResult unless it is NULL. Changing a flag expires the connection's
3193
+ * prepared statements.
3194
+ *
3195
+ * The C function is variadic, so the binary does not export it. This calls the
3196
+ * build's shim for the option's arguments and, as SQLite's JavaScript does,
3197
+ * returns SQLITE_MISUSE for any other option without calling wasm.
3198
+ *
3199
+ * Calls the build's shims, whose signatures come from Evolu's metadata because
3200
+ * SQLite's table omits them:
3201
+ *
3202
+ * - `sqlite3__wasm_db_config_s`, wasm type `i(iii)`, signature
3203
+ * `["sqlite3__wasm_db_config_s", "int", "sqlite3*", "int", "string"]`.
3204
+ * - `sqlite3__wasm_db_config_pii`, wasm type `i(iiiii)`, signature
3205
+ * `["sqlite3__wasm_db_config_pii", "int", "sqlite3*", "int", "*", "int",
3206
+ * "int"]`.
3207
+ * - `sqlite3__wasm_db_config_ip`, wasm type `i(iiii)`, signature
3208
+ * `["sqlite3__wasm_db_config_ip", "int", "sqlite3*", "int", "int", "int*"]`.
3209
+ *
3210
+ * See https://sqlite.org/c3ref/db_config.html.
3211
+ */
3212
+ export const sqlite3_db_config = (
3213
+ deps: SqliteWasmDep,
3214
+ ): ((db: SqliteDbPtr, ...args: SqliteDbConfigArgs) => SqliteResultCode) => {
3215
+ const {
3216
+ sqlite3__wasm_db_config_s,
3217
+ sqlite3__wasm_db_config_pii,
3218
+ sqlite3__wasm_db_config_ip,
3219
+ } = deps.sqliteWasm.exports;
3220
+ return (db, ...args) => {
3221
+ switch (args[0]) {
3222
+ case SQLITE_DBCONFIG_MAINDBNAME:
3223
+ return sqlite3__wasm_db_config_s(db, args[0], args[1]);
3224
+ case SQLITE_DBCONFIG_LOOKASIDE:
3225
+ return sqlite3__wasm_db_config_pii(
3226
+ db,
3227
+ args[0],
3228
+ args[1],
3229
+ args[2],
3230
+ args[3],
3231
+ );
3232
+ case SQLITE_DBCONFIG_ENABLE_FKEY:
3233
+ case SQLITE_DBCONFIG_ENABLE_TRIGGER:
3234
+ case SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION:
3235
+ case SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE:
3236
+ case SQLITE_DBCONFIG_ENABLE_QPSG:
3237
+ case SQLITE_DBCONFIG_TRIGGER_EQP:
3238
+ case SQLITE_DBCONFIG_RESET_DATABASE:
3239
+ case SQLITE_DBCONFIG_DEFENSIVE:
3240
+ case SQLITE_DBCONFIG_WRITABLE_SCHEMA:
3241
+ case SQLITE_DBCONFIG_LEGACY_ALTER_TABLE:
3242
+ case SQLITE_DBCONFIG_DQS_DML:
3243
+ case SQLITE_DBCONFIG_DQS_DDL:
3244
+ case SQLITE_DBCONFIG_ENABLE_VIEW:
3245
+ case SQLITE_DBCONFIG_LEGACY_FILE_FORMAT:
3246
+ case SQLITE_DBCONFIG_TRUSTED_SCHEMA:
3247
+ case SQLITE_DBCONFIG_STMT_SCANSTATUS:
3248
+ case SQLITE_DBCONFIG_REVERSE_SCANORDER:
3249
+ case SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE:
3250
+ case SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE:
3251
+ case SQLITE_DBCONFIG_ENABLE_COMMENTS:
3252
+ case SQLITE_DBCONFIG_FP_DIGITS:
3253
+ return sqlite3__wasm_db_config_ip(db, args[0], args[1], args[2] ?? 0);
3254
+ default:
3255
+ // TypeScript rejects other options, but JavaScript and casts can pass
3256
+ // them.
3257
+ return SQLITE_MISUSE;
3258
+ }
3259
+ };
3260
+ };
3261
+
3262
+ /** An option of {@link sqlite3_vtab_config} the build's shim supports. */
3263
+ export type SqliteVtabConfigOp =
3264
+ | typeof SQLITE_VTAB_CONSTRAINT_SUPPORT
3265
+ | typeof SQLITE_VTAB_INNOCUOUS
3266
+ | typeof SQLITE_VTAB_DIRECTONLY;
3267
+
3268
+ /**
3269
+ * Sets an option of the virtual table whose xCreate or xConnect method is
3270
+ * running, the only place it may be called.
3271
+ *
3272
+ * - SQLITE_VTAB_CONSTRAINT_SUPPORT with a non-zero value declares that xUpdate
3273
+ * returns SQLITE_CONSTRAINT only before changing anything, so SQLite can
3274
+ * honor the statement's ON CONFLICT mode.
3275
+ * - SQLITE_VTAB_INNOCUOUS marks the virtual table as safe to use in triggers and
3276
+ * views, and SQLITE_VTAB_DIRECTONLY prohibits that. Both ignore value.
3277
+ *
3278
+ * The C function is variadic, so the binary does not export it. The build's
3279
+ * shim returns SQLITE_MISUSE for any other option, including
3280
+ * SQLITE_VTAB_USES_ALL_SCHEMAS, which it does not support.
3281
+ *
3282
+ * Returns the build's shim `sqlite3__wasm_vtab_config`, wasm type `i(iii)`,
3283
+ * signature `["sqlite3__wasm_vtab_config", "int", "sqlite3*", "int", "int"]`.
3284
+ * Its signature comes from Evolu's metadata because SQLite's table omits it.
3285
+ *
3286
+ * See https://sqlite.org/c3ref/vtab_config.html.
3287
+ */
3288
+ export const sqlite3_vtab_config = (
3289
+ deps: SqliteWasmDep,
3290
+ ): ((
3291
+ db: SqliteDbPtr,
3292
+ op: SqliteVtabConfigOp,
3293
+ value: number,
3294
+ ) => SqliteResultCode) => deps.sqliteWasm.exports.sqlite3__wasm_vtab_config;