@livestore/wa-sqlite 1.0.1-dev.5 → 1.0.1-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/sqlite-api.js +13 -0
- package/src/types/index.d.ts +15 -1
package/package.json
CHANGED
package/src/sqlite-api.js
CHANGED
|
@@ -249,6 +249,19 @@ export function Factory(Module) {
|
|
|
249
249
|
};
|
|
250
250
|
})();
|
|
251
251
|
|
|
252
|
+
sqlite3.serialize = (function() {
|
|
253
|
+
const fname = 'sqlite3_serialize';
|
|
254
|
+
const f = Module.cwrap(fname, ...decl('nsnn:n'));
|
|
255
|
+
return function(db, schema, piSize, flags) {
|
|
256
|
+
verifyDatabase(db);
|
|
257
|
+
// TODO alloc + free memory for result?
|
|
258
|
+
const address = f(db, schema, piSize, flags);
|
|
259
|
+
const result = Module.HEAPU8.subarray(address, address + piSize);
|
|
260
|
+
|
|
261
|
+
return result;
|
|
262
|
+
};
|
|
263
|
+
})();
|
|
264
|
+
|
|
252
265
|
sqlite3.clear_bindings = (function() {
|
|
253
266
|
const fname = 'sqlite3_clear_bindings';
|
|
254
267
|
const f = Module.cwrap(fname, ...decl('n:n'));
|
package/src/types/index.d.ts
CHANGED
|
@@ -341,7 +341,6 @@ interface SQLiteAPI {
|
|
|
341
341
|
* unsigned mFlags Zero or more SQLITE_DESERIALIZE_* flags
|
|
342
342
|
* );
|
|
343
343
|
*/
|
|
344
|
-
|
|
345
344
|
deserialize(
|
|
346
345
|
db: number,
|
|
347
346
|
zSchema: string,
|
|
@@ -351,6 +350,21 @@ interface SQLiteAPI {
|
|
|
351
350
|
mFlags: number
|
|
352
351
|
): number;
|
|
353
352
|
|
|
353
|
+
/**
|
|
354
|
+
* unsigned char *sqlite3_serialize(
|
|
355
|
+
* sqlite3 *db, The database connection
|
|
356
|
+
* const char *zSchema, Which DB to serialize. ex: "main", "temp", ...
|
|
357
|
+
* sqlite3_int64 *piSize, Write size of the DB here, if not NULL
|
|
358
|
+
* unsigned int mFlags Zero or more SQLITE_SERIALIZE_* flags
|
|
359
|
+
* );
|
|
360
|
+
*/
|
|
361
|
+
serialize(
|
|
362
|
+
db: number,
|
|
363
|
+
zSchema: string,
|
|
364
|
+
piSize: number,
|
|
365
|
+
mFlags: number
|
|
366
|
+
): Uint8Array;
|
|
367
|
+
|
|
354
368
|
/**
|
|
355
369
|
* Reset all bindings on a prepared statement.
|
|
356
370
|
* @see https://www.sqlite.org/c3ref/clear_bindings.html
|