@@ -45,7 +45,8 @@ public final class SQLiteDatabase: DatabaseProtocol, @unchecked Sendable {
4545 public static func makeShared(
4646 path: String ,
4747 busyTimeout: TimeInterval = 5 ,
48- collationSequences: [ String : @Sendable ( String , String ) -> ComparisonResult ] = [ : ]
48+ collationSequences: [ String : @Sendable ( String , String ) -> ComparisonResult ] = [ : ] ,
49+ observeLifecycleEvents: Bool = true
4950 ) throws -> SQLiteDatabase {
5051 guard path != " :memory: " else {
5152 throw SQLiteError . SQLITE_IOERR
@@ -71,7 +72,8 @@ public final class SQLiteDatabase: DatabaseProtocol, @unchecked Sendable {
7172 database = try SQLiteDatabase (
7273 path: url. path,
7374 busyTimeout: busyTimeout,
74- collationSequences: collationSequences
75+ collationSequences: collationSequences,
76+ observeLifecycleEvents: observeLifecycleEvents
7577 )
7678 } catch {
7779 databaseError = error
@@ -95,7 +97,8 @@ public final class SQLiteDatabase: DatabaseProtocol, @unchecked Sendable {
9597 public init (
9698 path: String = " :memory: " ,
9799 busyTimeout: TimeInterval = 5 ,
98- collationSequences: [ String : @Sendable ( String , String ) -> ComparisonResult ] = [ : ]
100+ collationSequences: [ String : @Sendable ( String , String ) -> ComparisonResult ] = [ : ] ,
101+ observeLifecycleEvents: Bool = true
99102 ) throws {
100103 database = try Self . open (
101104 at: path,
@@ -116,7 +119,9 @@ public final class SQLiteDatabase: DatabaseProtocol, @unchecked Sendable {
116119 try checkIsSQLiteVersionSupported ( sqliteVersion)
117120 precondition ( enforcesForeignKeyConstraints)
118121
119- registerForAppNotifications ( )
122+ if observeLifecycleEvents {
123+ registerForAppNotifications ( )
124+ }
120125 changeNotifier. start ( )
121126 }
122127
0 commit comments