Skip to content

Commit 7a1ebdb

Browse files
update all references to Drift
1 parent d95edd2 commit 7a1ebdb

File tree

5 files changed

+13
-23
lines changed

5 files changed

+13
-23
lines changed

lib/src/web/database.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ Future<T> wrapSqliteException<T>(Future<T> Function() callback) async {
267267
} on RemoteException catch (ex) {
268268
if (ex.toString().contains('SqliteException')) {
269269
RegExp regExp = RegExp(r'SqliteException\((\d+)\)');
270-
// Drift wraps these in remote errors
270+
// The SQLite Web package wraps these in remote errors
271271
throw SqliteException(
272272
int.parse(regExp.firstMatch(ex.message)?.group(1) ?? '0'),
273273
ex.message);

lib/src/web/web_isolate_connection_factory.dart

+2-12
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,13 @@ class IsolateConnectionFactoryImpl
2323
required this.mutex,
2424
required SerializedPortClient upstreamPort});
2525

26-
/// Open a new SqliteConnection.
27-
///
28-
/// This opens a single connection in a background execution isolate.
26+
/// Not supported on web
2927
@override
3028
SqliteConnection open({String? debugName, bool readOnly = false}) {
3129
throw UnimplementedError();
3230
}
3331

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
4333
@override
4434
Future<CommonDatabase> openRawDatabase({bool readOnly = false}) async {
4535
throw UnimplementedError();

lib/src/web/web_sqlite_open_factory.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class DefaultSqliteOpenFactory
4242

4343
@override
4444

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
4747
/// and automatic persistence storage selection.
4848
/// Due to being asynchronous, the under laying CommonDatabase is not accessible
4949
Future<SqliteConnection> openConnection(SqliteOpenOptions options) async {

test/server/worker_server.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ Future<void> hybridMain(StreamChannel<Object?> channel) async {
1919
'sqlite3.wasm file should be present in the ./assets folder');
2020
}
2121

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())) {
2424
final process = await Process.run(Platform.executable, [
2525
'compile',
2626
'js',
2727
'-o',
28-
driftWorkerPath,
28+
workerPath,
2929
'-O0',
3030
'lib/src/web/worker/worker.dart',
3131
]);

test/utils/web_test_utils.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ class TestUtils extends AbstractTestUtils {
2222
final port = await channel.stream.first as int;
2323
final sqliteWasmUri = 'http://localhost:$port/sqlite3.wasm';
2424
// 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';
2626

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);
3030

3131
webOptions = SqliteOptions(
3232
webSqliteOptions: WebSqliteOptions(
33-
wasmUri: sqliteWasmUri.toString(), workerUri: sqliteDriftUri));
33+
wasmUri: sqliteWasmUri.toString(), workerUri: sqliteUri));
3434
}
3535

3636
@override

0 commit comments

Comments
 (0)