File tree 8 files changed +27
-26
lines changed
8 files changed +27
-26
lines changed Original file line number Diff line number Diff line change
1
+ ## 0.7.0
2
+
3
+ - BREAKING CHANGE: Update all Database types to use a ` CommonDatabase ` interface.
4
+ - Update ` openDB ` and ` open ` methods to be synchronous.
5
+ - Fix ` ArgumentError (Invalid argument(s): argument value for 'return_value' is null) ` in sqlite3 when closing the database connection by upgrading to version 2.4.4.
6
+
1
7
## 0.7.0-alpha.5
2
8
3
9
- The dependency for the ` Drift ` package is now removed in favour of using the new ` sqlite3_web ` package.
Original file line number Diff line number Diff line change 1
- import 'dart:async' ;
2
1
import 'dart:io' ;
3
2
import 'dart:isolate' ;
4
3
@@ -11,8 +10,8 @@ class TestOpenFactory extends DefaultSqliteOpenFactory {
11
10
TestOpenFactory ({required super .path, super .sqliteOptions});
12
11
13
12
@override
14
- FutureOr < CommonDatabase > open (SqliteOpenOptions options) async {
15
- final db = await super .open (options);
13
+ CommonDatabase open (SqliteOpenOptions options) {
14
+ final db = super .open (options);
16
15
17
16
db.createFunction (
18
17
functionName: 'sleep' ,
Original file line number Diff line number Diff line change 1
- import 'dart:async' ;
2
1
import 'dart:ffi' ;
3
2
4
3
import 'package:sqlite3/common.dart' ;
@@ -17,7 +16,7 @@ class TestOpenFactory extends DefaultSqliteOpenFactory {
17
16
this .sqlitePath = defaultSqlitePath});
18
17
19
18
@override
20
- FutureOr < CommonDatabase > open (SqliteOpenOptions options) async {
19
+ CommonDatabase open (SqliteOpenOptions options) {
21
20
// For details, see:
22
21
// https://pub.dev/packages/sqlite3#manually-providing-sqlite3-libraries
23
22
sqlite_open.open.overrideFor (sqlite_open.OperatingSystem .linux, () {
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ abstract class SqliteOpenFactory<Database extends sqlite.CommonDatabase> {
15
15
String get path;
16
16
17
17
/// Opens a direct connection to the SQLite database
18
- FutureOr < Database > open (SqliteOpenOptions options);
18
+ Database open (SqliteOpenOptions options);
19
19
20
20
/// Opens an asynchronous [SqliteConnection]
21
21
FutureOr <SqliteConnection > openConnection (SqliteOpenOptions options);
@@ -77,14 +77,14 @@ abstract class AbstractDefaultSqliteOpenFactory<
77
77
@protected
78
78
79
79
/// Opens a direct connection to a SQLite database connection
80
- FutureOr < Database > openDB (SqliteOpenOptions options);
80
+ Database openDB (SqliteOpenOptions options);
81
81
82
82
@override
83
83
84
84
/// Opens a direct connection to a SQLite database connection
85
85
/// and executes setup pragma statements to initialize the DB
86
- FutureOr < Database > open (SqliteOpenOptions options) async {
87
- var db = await openDB (options);
86
+ Database open (SqliteOpenOptions options) {
87
+ var db = openDB (options);
88
88
89
89
// Pragma statements don't have the same BUSY_TIMEOUT behavior as normal statements.
90
90
// We add a manual retry loop for those.
Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ void _sqliteConnectionIsolate(_SqliteConnectionParams params) async {
264
264
await client.post (const InitDb ());
265
265
}
266
266
267
- final db = await params.openFactory.open (SqliteOpenOptions (
267
+ final db = params.openFactory.open (SqliteOpenOptions (
268
268
primaryConnection: params.primary, readOnly: params.readOnly));
269
269
270
270
runZonedGuarded (() async {
Original file line number Diff line number Diff line change @@ -34,19 +34,10 @@ class DefaultSqliteOpenFactory
34
34
35
35
@override
36
36
37
- /// It is possible to open a CommonDatabase in the main Dart/JS context with standard sqlite3.dart,
38
- /// This connection requires an external Webworker implementation for asynchronous operations.
39
- /// Do not use this in conjunction with async connections provided by Drift
40
- Future <CommonDatabase > openDB (SqliteOpenOptions options) async {
41
- final wasmSqlite = await WasmSqlite3 .loadFromUrl (
42
- Uri .parse (sqliteOptions.webSqliteOptions.wasmUri));
43
-
44
- wasmSqlite.registerVirtualFileSystem (
45
- await IndexedDbFileSystem .open (dbName: path),
46
- makeDefault: true ,
47
- );
48
-
49
- return wasmSqlite.open (path);
37
+ /// This is currently not supported on web
38
+ CommonDatabase openDB (SqliteOpenOptions options) {
39
+ throw UnimplementedError (
40
+ 'Direct access to CommonDatabase is not available on web.' );
50
41
}
51
42
52
43
@override
Original file line number Diff line number Diff line change @@ -5,9 +5,15 @@ repository: https://github.com/powersync-ja/sqlite_async.dart
5
5
environment :
6
6
sdk : " >=3.4.0 <4.0.0"
7
7
8
+ topics :
9
+ - sqlite
10
+ - async
11
+ - sql
12
+ - flutter
13
+
8
14
dependencies :
15
+ sqlite3 : " ^2.4.4"
9
16
sqlite3_web : ^0.1.2-wip
10
- sqlite3 : ^2.4.4
11
17
async : ^2.10.0
12
18
collection : ^1.17.0
13
19
mutex : ^3.1.0
Original file line number Diff line number Diff line change @@ -21,11 +21,11 @@ class TestSqliteOpenFactory extends TestDefaultSqliteOpenFactory {
21
21
initStatements});
22
22
23
23
@override
24
- FutureOr < CommonDatabase > open (SqliteOpenOptions options) async {
24
+ CommonDatabase open (SqliteOpenOptions options) {
25
25
sqlite_open.open.overrideFor (sqlite_open.OperatingSystem .linux, () {
26
26
return DynamicLibrary .open (sqlitePath);
27
27
});
28
- final db = await super .open (options);
28
+ final db = super .open (options);
29
29
30
30
db.createFunction (
31
31
functionName: 'test_sleep' ,
You can’t perform that action at this time.
0 commit comments