Skip to content

Commit

Permalink
Merge pull request #90 from westito/vfs2
Browse files Browse the repository at this point in the history
Add VFS 2.0, based on storing blocks instead of full files.
  • Loading branch information
simolus3 authored May 3, 2022
2 parents 5908b03 + ca181fe commit f624b18
Show file tree
Hide file tree
Showing 6 changed files with 785 additions and 108 deletions.
7 changes: 7 additions & 0 deletions sqlite3/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
- Add support for application-defined window functions. To register a custom
window function, implement `WindowFunction` and register your function with
`database.registerAggregateFunction`.
- __Breaking__ (For the experimental `package:sqlite3/wasm.dart` library):
- The IndexedDB implementation now stores data in 4k blocks instead of full files.s
- Removed `IndexedDbFileSystem.load`. Use `IndexedDbFileSystem.open` instead.
- An `IndexedDbFileSystem` now stores all files, the concept of a persistence
root has been removed.
To access independent databases, use two `IndexedDbFileSystem`s with a different
database name.

## 1.6.4

Expand Down
9 changes: 5 additions & 4 deletions sqlite3/example/web/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:http/http.dart' as http;
import 'package:sqlite3/wasm.dart';

Future<void> main() async {
final fs = await IndexedDbFileSystem.load('/db/');
final fs = await IndexedDbFileSystem.open(dbName: 'test');
print('loaded fs');

final response = await http.get(Uri.parse('sqlite3.wasm'));
Expand All @@ -12,7 +12,7 @@ Future<void> main() async {
print('Version of sqlite used is ${sqlite.version}');

print('opening a persistent database');
var db = sqlite.open('/db/test.db');
var db = sqlite.open('test.db');

if (db.userVersion == 0) {
db
Expand All @@ -22,8 +22,9 @@ Future<void> main() async {
}

print(db.select('SELECT * FROM foo'));
await fs.flush();

print('re-opening dataabse');
db = sqlite.open('/db/test.db');
print('re-opening database');
db = sqlite.open('test.db');
print(db.select('SELECT * FROM foo'));
}
Loading

0 comments on commit f624b18

Please sign in to comment.