Skip to content

Commit 8a95b4f

Browse files
committed
Make setting commit hooks a noop if unsupported
We set them to null when closing databases, and crashing if the methods are unavailable (which they are on older WebAssembly modules) is terrible.
1 parent b81d20a commit 8a95b4f

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

sqlite3/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 2.7.1
2+
3+
- Web: Fix a crash when using version `2.7.0` of this package with an older
4+
WebAssembly bundle.
5+
Note: Version `2.7.0` has been retracted from pub.dev for this reason.
6+
17
## 2.7.0
28

39
- Add support for commit and rollback hooks as well as a predicate that can

sqlite3/lib/src/wasm/wasm_interop.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,11 @@ class WasmBindings {
297297
}
298298

299299
void dart_sqlite3_commits(Pointer db, int id) {
300-
return _commit_hooks!.callReturningVoid2(db.toJS, id.toJS);
300+
return _commit_hooks?.callReturningVoid2(db.toJS, id.toJS);
301301
}
302302

303303
void dart_sqlite3_rollbacks(Pointer db, int id) {
304-
return _rollback_hooks!.callReturningVoid2(db.toJS, id.toJS);
304+
return _rollback_hooks?.callReturningVoid2(db.toJS, id.toJS);
305305
}
306306

307307
int sqlite3_exec(Pointer db, Pointer sql, Pointer callback,

sqlite3/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: sqlite3
22
description: Provides lightweight yet convenient bindings to SQLite by using dart:ffi
3-
version: 2.7.0
3+
version: 2.7.1
44
homepage: https://github.com/simolus3/sqlite3.dart/tree/main/sqlite3
55
issue_tracker: https://github.com/simolus3/sqlite3.dart/issues
66

0 commit comments

Comments
 (0)