@livestore/wa-sqlite 1.0.1-dev.21 → 1.0.1-dev.23
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 +3 -14
package/package.json
CHANGED
package/src/sqlite-api.js
CHANGED
|
@@ -262,28 +262,17 @@ export function Factory(Module) {
|
|
|
262
262
|
address = f(db, schema, piSize, SQLITE_SERIALIZE_NOCOPY);
|
|
263
263
|
const size = Module.getValue(piSize, '*');
|
|
264
264
|
const result = Module.HEAPU8.subarray(address, address + size);
|
|
265
|
+
// NOTE Given that the memory is owned by SQLite, we must copy it.
|
|
265
266
|
return new Uint8Array(result.slice());
|
|
266
267
|
} else {
|
|
267
268
|
const size = Module.getValue(piSize, '*');
|
|
268
269
|
const result = Module.HEAPU8.subarray(address, address + size);
|
|
269
|
-
return
|
|
270
|
+
// Here we're getting a copy of the memory, so we can return it directly.
|
|
271
|
+
return new Uint8Array(result);
|
|
270
272
|
}
|
|
271
273
|
};
|
|
272
274
|
})();
|
|
273
275
|
|
|
274
|
-
// sqlite3.serialize = (function() {
|
|
275
|
-
// const fname = 'sqlite3_serialize';
|
|
276
|
-
// const f = Module.cwrap(fname, ...decl('nsnn:n'));
|
|
277
|
-
// return function(db, schema, flags) {
|
|
278
|
-
// verifyDatabase(db);
|
|
279
|
-
// const piSize = tmpPtr[0];
|
|
280
|
-
// const address = f(db, schema, piSize, flags);
|
|
281
|
-
// const size = Module.getValue(piSize, '*');
|
|
282
|
-
// const result = Module.HEAPU8.subarray(address, address + size);
|
|
283
|
-
// return result;
|
|
284
|
-
// };
|
|
285
|
-
// })();
|
|
286
|
-
|
|
287
276
|
sqlite3.backup = (function() {
|
|
288
277
|
const fInit = Module.cwrap('sqlite3_backup_init', ...decl('nsns:n'));
|
|
289
278
|
const fStep = Module.cwrap('sqlite3_backup_step', ...decl('nn:n'));
|