File tree 2 files changed +9
-7
lines changed
2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change
1
+ import 'dart:async' ;
1
2
import 'dart:io' ;
2
3
import 'dart:isolate' ;
3
4
5
+ import 'package:sqlite3/common.dart' ;
4
6
import 'package:sqlite_async/sqlite_async.dart' ;
5
- import 'package:sqlite3/sqlite3.dart' as sqlite;
6
7
7
8
/// Since the functions need to be created on every SQLite connection,
8
9
/// we do this in a SqliteOpenFactory.
9
10
class TestOpenFactory extends DefaultSqliteOpenFactory {
10
11
TestOpenFactory ({required super .path, super .sqliteOptions});
11
12
12
13
@override
13
- sqlite. Database open (SqliteOpenOptions options) {
14
- final db = super .open (options);
14
+ FutureOr < CommonDatabase > open (SqliteOpenOptions options) async {
15
+ final db = await super .open (options);
15
16
16
17
db.createFunction (
17
18
functionName: 'sleep' ,
18
- argumentCount: const sqlite. AllowedArgumentCount (1 ),
19
+ argumentCount: const AllowedArgumentCount (1 ),
19
20
function: (args) {
20
21
final millis = args[0 ] as int ;
21
22
sleep (Duration (milliseconds: millis));
@@ -25,7 +26,7 @@ class TestOpenFactory extends DefaultSqliteOpenFactory {
25
26
26
27
db.createFunction (
27
28
functionName: 'isolate_name' ,
28
- argumentCount: const sqlite. AllowedArgumentCount (0 ),
29
+ argumentCount: const AllowedArgumentCount (0 ),
29
30
function: (args) {
30
31
return Isolate .current.debugName;
31
32
},
Original file line number Diff line number Diff line change
1
+ import 'dart:async' ;
1
2
import 'dart:ffi' ;
2
3
4
+ import 'package:sqlite3/common.dart' ;
3
5
import 'package:sqlite_async/sqlite_async.dart' ;
4
6
import 'package:sqlite3/open.dart' as sqlite_open;
5
- import 'package:sqlite3/sqlite3.dart' as sqlite;
6
7
7
8
const defaultSqlitePath = 'libsqlite3.so.0' ;
8
9
@@ -16,7 +17,7 @@ class TestOpenFactory extends DefaultSqliteOpenFactory {
16
17
this .sqlitePath = defaultSqlitePath});
17
18
18
19
@override
19
- sqlite. Database open (SqliteOpenOptions options) {
20
+ FutureOr < CommonDatabase > open (SqliteOpenOptions options) async {
20
21
// For details, see:
21
22
// https://pub.dev/packages/sqlite3#manually-providing-sqlite3-libraries
22
23
sqlite_open.open.overrideFor (sqlite_open.OperatingSystem .linux, () {
You can’t perform that action at this time.
0 commit comments