11import * as SQLite from '@journeyapps/wa-sqlite' ;
22import SQLiteESMFactory from '@journeyapps/wa-sqlite/dist/wa-sqlite-async.mjs' ;
3+ // import * as SQLite from 'wa-sqlite';
4+ // import SQLiteESMFactory from 'wa-sqlite/dist/wa-sqlite-async.mjs';
35import {
46 PrepareOptions ,
57 ResetOptions ,
@@ -14,10 +16,10 @@ import {
1416 UpdateListener
1517} from '@sqlite-js/driver' ;
1618import * as mutex from 'async-mutex' ;
17- import { OPFSCoopSyncVFS2 } from './OPFSCoopSyncVFS2' ;
1819
1920// Initialize SQLite.
2021export const module = await SQLiteESMFactory ( ) ;
22+ console . log ( 'module' , module ) ;
2123export const sqlite3 = SQLite . Factory ( module ) ;
2224
2325const m = new mutex . Mutex ( ) ;
@@ -233,7 +235,8 @@ class StatementImpl implements SqliteDriverStatement {
233235 while ( ( await sqlite3 . step ( stmt ) ) === SQLite . SQLITE_ROW ) { }
234236
235237 const changes = sqlite3 . changes ( this . db ) ;
236- const lastInsertRowId = BigInt ( sqlite3 . last_insert_id ( this . db ) ) ;
238+ // const lastInsertRowId = BigInt(sqlite3.last_insert_id(this.db));
239+ const lastInsertRowId = 0n ;
237240
238241 return { changes, lastInsertRowId } ;
239242 } catch ( e : any ) {
@@ -253,26 +256,20 @@ class StatementImpl implements SqliteDriverStatement {
253256
254257export class WaSqliteConnection implements SqliteDriverConnection {
255258 db : number ;
256- vfs : OPFSCoopSyncVFS2 ;
257259
258260 statements = new Set < StatementImpl > ( ) ;
259261
260- static async open (
261- filename : string ,
262- vfs : OPFSCoopSyncVFS2
263- ) : Promise < WaSqliteConnection > {
262+ static async open ( filename : string ) : Promise < WaSqliteConnection > {
264263 // Open the database.
265264 const db = await sqlite3 . open_v2 ( filename ) ;
266- return new WaSqliteConnection ( db , vfs , filename ) ;
265+ return new WaSqliteConnection ( db , filename ) ;
267266 }
268267
269268 constructor (
270269 db : number ,
271- vfs : OPFSCoopSyncVFS2 ,
272270 public path : string
273271 ) {
274272 this . db = db ;
275- this . vfs = vfs ;
276273 }
277274
278275 async close ( ) {
@@ -290,7 +287,8 @@ export class WaSqliteConnection implements SqliteDriverConnection {
290287
291288 async getLastChanges ( ) : Promise < SqliteChanges > {
292289 const changes = sqlite3 . changes ( this . db ) ;
293- const lastInsertRowId = BigInt ( sqlite3 . last_insert_id ( this . db ) ) ;
290+ // const lastInsertRowId = BigInt(sqlite3.last_insert_id(this.db));
291+ const lastInsertRowId = 0n ;
294292
295293 return { changes, lastInsertRowId } ;
296294 }
0 commit comments