Skip to content

Commit

Permalink
Make setting commit hooks a noop if unsupported
Browse files Browse the repository at this point in the history
We set them to null when closing databases, and crashing if the methods
are unavailable (which they are on older WebAssembly modules) is
terrible.
  • Loading branch information
simolus3 committed Jan 20, 2025
1 parent b81d20a commit 8a95b4f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions sqlite3/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2.7.1

- Web: Fix a crash when using version `2.7.0` of this package with an older
WebAssembly bundle.
Note: Version `2.7.0` has been retracted from pub.dev for this reason.

## 2.7.0

- Add support for commit and rollback hooks as well as a predicate that can
Expand Down
4 changes: 2 additions & 2 deletions sqlite3/lib/src/wasm/wasm_interop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,11 @@ class WasmBindings {
}

void dart_sqlite3_commits(Pointer db, int id) {
return _commit_hooks!.callReturningVoid2(db.toJS, id.toJS);
return _commit_hooks?.callReturningVoid2(db.toJS, id.toJS);
}

void dart_sqlite3_rollbacks(Pointer db, int id) {
return _rollback_hooks!.callReturningVoid2(db.toJS, id.toJS);
return _rollback_hooks?.callReturningVoid2(db.toJS, id.toJS);
}

int sqlite3_exec(Pointer db, Pointer sql, Pointer callback,
Expand Down
2 changes: 1 addition & 1 deletion sqlite3/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: sqlite3
description: Provides lightweight yet convenient bindings to SQLite by using dart:ffi
version: 2.7.0
version: 2.7.1
homepage: https://github.com/simolus3/sqlite3.dart/tree/main/sqlite3
issue_tracker: https://github.com/simolus3/sqlite3.dart/issues

Expand Down

0 comments on commit 8a95b4f

Please sign in to comment.