File tree 5 files changed +13
-23
lines changed
5 files changed +13
-23
lines changed Original file line number Diff line number Diff line change @@ -267,7 +267,7 @@ Future<T> wrapSqliteException<T>(Future<T> Function() callback) async {
267
267
} on RemoteException catch (ex) {
268
268
if (ex.toString ().contains ('SqliteException' )) {
269
269
RegExp regExp = RegExp (r'SqliteException\((\d+)\)' );
270
- // Drift wraps these in remote errors
270
+ // The SQLite Web package wraps these in remote errors
271
271
throw SqliteException (
272
272
int .parse (regExp.firstMatch (ex.message)? .group (1 ) ?? '0' ),
273
273
ex.message);
Original file line number Diff line number Diff line change @@ -23,23 +23,13 @@ class IsolateConnectionFactoryImpl
23
23
required this .mutex,
24
24
required SerializedPortClient upstreamPort});
25
25
26
- /// Open a new SqliteConnection.
27
- ///
28
- /// This opens a single connection in a background execution isolate.
26
+ /// Not supported on web
29
27
@override
30
28
SqliteConnection open ({String ? debugName, bool readOnly = false }) {
31
29
throw UnimplementedError ();
32
30
}
33
31
34
- /// Opens a synchronous sqlite.Database directly in the current isolate.
35
- /// This should not be used in conjunction with async connections provided
36
- /// by Drift.
37
- ///
38
- /// This gives direct access to the database, but:
39
- /// 1. No app-level locking is performed automatically. Transactions may fail
40
- /// with SQLITE_BUSY if another isolate is using the database at the same time.
41
- /// 2. Other connections are not notified of any updates to tables made within
42
- /// this connection.
32
+ /// Not supported on web
43
33
@override
44
34
Future <CommonDatabase > openRawDatabase ({bool readOnly = false }) async {
45
35
throw UnimplementedError ();
Original file line number Diff line number Diff line change @@ -42,8 +42,8 @@ class DefaultSqliteOpenFactory
42
42
43
43
@override
44
44
45
- /// Currently this only uses the Drift WASM implementation.
46
- /// The Drift SQLite package provides built in async Web worker functionality
45
+ /// Currently this only uses the SQLite Web WASM implementation.
46
+ /// This provides built in async Web worker functionality
47
47
/// and automatic persistence storage selection.
48
48
/// Due to being asynchronous, the under laying CommonDatabase is not accessible
49
49
Future <SqliteConnection > openConnection (SqliteOpenOptions options) async {
Original file line number Diff line number Diff line change @@ -19,13 +19,13 @@ Future<void> hybridMain(StreamChannel<Object?> channel) async {
19
19
'sqlite3.wasm file should be present in the ./assets folder' );
20
20
}
21
21
22
- final driftWorkerPath = p.join (directory.path, 'db_worker.js' );
23
- if (! (await File (driftWorkerPath ).exists ())) {
22
+ final workerPath = p.join (directory.path, 'db_worker.js' );
23
+ if (! (await File (workerPath ).exists ())) {
24
24
final process = await Process .run (Platform .executable, [
25
25
'compile' ,
26
26
'js' ,
27
27
'-o' ,
28
- driftWorkerPath ,
28
+ workerPath ,
29
29
'-O0' ,
30
30
'lib/src/web/worker/worker.dart' ,
31
31
]);
Original file line number Diff line number Diff line change @@ -22,15 +22,15 @@ class TestUtils extends AbstractTestUtils {
22
22
final port = await channel.stream.first as int ;
23
23
final sqliteWasmUri = 'http://localhost:$port /sqlite3.wasm' ;
24
24
// Cross origin workers are not supported, but we can supply a Blob
25
- var sqliteDriftUri = 'http://localhost:$port /db_worker.js' ;
25
+ var sqliteUri = 'http://localhost:$port /db_worker.js' ;
26
26
27
- final blob = Blob (< String > [ 'importScripts("$ sqliteDriftUri ");' ],
28
- 'application/javascript' );
29
- sqliteDriftUri = _createObjectURL (blob);
27
+ final blob = Blob (
28
+ < String > [ 'importScripts("$ sqliteUri ");' ], 'application/javascript' );
29
+ sqliteUri = _createObjectURL (blob);
30
30
31
31
webOptions = SqliteOptions (
32
32
webSqliteOptions: WebSqliteOptions (
33
- wasmUri: sqliteWasmUri.toString (), workerUri: sqliteDriftUri ));
33
+ wasmUri: sqliteWasmUri.toString (), workerUri: sqliteUri ));
34
34
}
35
35
36
36
@override
You can’t perform that action at this time.
0 commit comments