@livestore/wa-sqlite 1.0.1-dev.17 → 1.0.1-dev.18
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 +20 -2
- package/src/types/index.d.ts +1 -1
package/package.json
CHANGED
package/src/sqlite-api.js
CHANGED
|
@@ -249,19 +249,37 @@ export function Factory(Module) {
|
|
|
249
249
|
};
|
|
250
250
|
})();
|
|
251
251
|
|
|
252
|
+
const SQLITE_SERIALIZE_NOCOPY = 0x0_01
|
|
253
|
+
|
|
252
254
|
sqlite3.serialize = (function() {
|
|
253
255
|
const fname = 'sqlite3_serialize';
|
|
254
256
|
const f = Module.cwrap(fname, ...decl('nsnn:n'));
|
|
255
|
-
return function(db, schema
|
|
257
|
+
return function(db, schema) {
|
|
256
258
|
verifyDatabase(db);
|
|
257
259
|
const piSize = tmpPtr[0];
|
|
258
|
-
|
|
260
|
+
let address = f(db, schema, piSize, 0);
|
|
261
|
+
if (address === 0) {
|
|
262
|
+
address = f(db, schema, piSize, SQLITE_SERIALIZE_NOCOPY);
|
|
263
|
+
}
|
|
259
264
|
const size = Module.getValue(piSize, '*');
|
|
260
265
|
const result = Module.HEAPU8.subarray(address, address + size);
|
|
261
266
|
return result;
|
|
262
267
|
};
|
|
263
268
|
})();
|
|
264
269
|
|
|
270
|
+
// sqlite3.serialize = (function() {
|
|
271
|
+
// const fname = 'sqlite3_serialize';
|
|
272
|
+
// const f = Module.cwrap(fname, ...decl('nsnn:n'));
|
|
273
|
+
// return function(db, schema, flags) {
|
|
274
|
+
// verifyDatabase(db);
|
|
275
|
+
// const piSize = tmpPtr[0];
|
|
276
|
+
// const address = f(db, schema, piSize, flags);
|
|
277
|
+
// const size = Module.getValue(piSize, '*');
|
|
278
|
+
// const result = Module.HEAPU8.subarray(address, address + size);
|
|
279
|
+
// return result;
|
|
280
|
+
// };
|
|
281
|
+
// })();
|
|
282
|
+
|
|
265
283
|
sqlite3.clear_bindings = (function() {
|
|
266
284
|
const fname = 'sqlite3_clear_bindings';
|
|
267
285
|
const f = Module.cwrap(fname, ...decl('n:n'));
|