@@ -13,25 +13,24 @@ import 'package:sqlite3/sqlite3.dart';
13
13
import '../../utils/file.dart' ;
14
14
import '../custom_sqlite3_database.dart' ;
15
15
16
- QueryExecutor _openDatabase (File file) {
17
- // Create the parent directory if it doesn't exist. sqlite will emit
18
- // confusing misuse warnings otherwise
19
- final dir = file.parent;
20
- if (! dir.existsSync ()) {
21
- dir.createSync (recursive: true );
22
- }
23
-
24
- final db = sqlite3.open (file.path);
25
- return NativeDatabase .opened (
26
- DatabaseProfiler (db, explain: kDebugMode),
27
- setup: (rawDb) {
28
- rawDb
29
- ..execute ('PRAGMA journal_mode=WAL;' )
30
- ..execute ('PRAGMA foreign_keys=ON;' )
31
- ..execute ('PRAGMA synchronous=NORMAL;' );
32
- },
33
- );
34
- }
16
+ QueryExecutor _openDatabase (File file) => LazyDatabase (() {
17
+ // Create the parent directory if it doesn't exist. sqlite will emit
18
+ // confusing misuse warnings otherwise
19
+ final dir = file.parent;
20
+ if (! dir.existsSync ()) {
21
+ dir.createSync (recursive: true );
22
+ }
23
+ final db = sqlite3.open (file.path);
24
+ return NativeDatabase .opened (
25
+ DatabaseProfiler (db, explain: kDebugMode),
26
+ setup: (rawDb) {
27
+ rawDb
28
+ ..execute ('PRAGMA journal_mode=WAL;' )
29
+ ..execute ('PRAGMA foreign_keys=ON;' )
30
+ ..execute ('PRAGMA synchronous=NORMAL;' );
31
+ },
32
+ );
33
+ });
35
34
36
35
/// Connect to the database.
37
36
Future <QueryExecutor > openQueryExecutor ({
0 commit comments