-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1fe6d78
commit d69169d
Showing
3 changed files
with
49 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import SQLiteESMFactory from '../../dist/wa-sqlite-async.mjs'; | ||
import * as SQLite from '../../src/sqlite-api.js'; | ||
import { IDBBatchAtomicVFS } from '../../src/examples/IDBBatchAtomicVFS.js'; | ||
|
||
const SEARCH_PARAMS = new URLSearchParams(location.search); | ||
const IDB_NAME = SEARCH_PARAMS.get('idb') ?? 'sqlite-vfs'; | ||
const DB_NAME = SEARCH_PARAMS.get('db') ?? 'sqlite.db'; | ||
|
||
(async function() { | ||
const module = await SQLiteESMFactory(); | ||
const sqlite3 = SQLite.Factory(module); | ||
|
||
const vfs = new IDBBatchAtomicVFS(IDB_NAME); | ||
sqlite3.vfs_register(vfs, true); | ||
|
||
const db = await sqlite3.open_v2(DB_NAME, SQLite.SQLITE_OPEN_READWRITE, IDB_NAME); | ||
|
||
const results = [] | ||
await sqlite3.exec(db, 'PRAGMA integrity_check;', (row, columns) => { | ||
results.push(row[0]); | ||
}); | ||
await sqlite3.close(db); | ||
|
||
postMessage(results); | ||
})(); |