@livestore/wa-sqlite 1.0.1-dev.12 → 1.0.1-dev.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livestore/wa-sqlite",
3
- "version": "1.0.1-dev.12",
3
+ "version": "1.0.1-dev.13",
4
4
  "type": "module",
5
5
  "main": "src/sqlite-api.js",
6
6
  "types": "src/types/index.d.ts",
package/src/sqlite-api.js CHANGED
@@ -458,7 +458,7 @@ export function Factory(Module) {
458
458
  // return SQLite.SQLITE_OK;
459
459
  // };
460
460
  sqlite3.exec = function(db, sql, callback) {
461
- const { stmts, finalize } = sqlite3.statements(db, sql);
461
+ const stmts = sqlite3.statements(db, sql);
462
462
  for (const stmt of stmts) {
463
463
  let columns;
464
464
  while (sqlite3.step(stmt) === SQLite.SQLITE_ROW) {
@@ -469,7 +469,9 @@ export function Factory(Module) {
469
469
  }
470
470
  }
471
471
  }
472
- finalize();
472
+ for (const stmt of stmts) {
473
+ sqlite3.finalize(stmt);
474
+ }
473
475
  return SQLite.SQLITE_OK;
474
476
  };
475
477
 
@@ -778,13 +780,7 @@ export function Factory(Module) {
778
780
  // }
779
781
  // }
780
782
 
781
- const finalize = () => {
782
- while (onFinally.length) {
783
- onFinally.pop()();
784
- }
785
- }
786
-
787
- return { stmts, finalize };
783
+ return stmts;
788
784
  };
789
785
 
790
786
  sqlite3.step = (function() {
@@ -759,7 +759,7 @@ interface SQLiteAPI {
759
759
  * @param options
760
760
  */
761
761
  // statements(db: number, sql: string, options?: SQLitePrepareOptions): AsyncIterable<number>;
762
- statements(db: number, sql: string, options?: SQLitePrepareOptions): { stmts: ReadonlyArray<number>; finalize: () => void; };
762
+ statements(db: number, sql: string, options?: SQLitePrepareOptions): ReadonlyArray<number>;
763
763
 
764
764
  /**
765
765
  * Evaluate an SQL statement