@@ -36,12 +36,10 @@ import StructuredQueriesTestSupport
3636/// - Parameters:
3737/// - includeSQL: Whether to snapshot the SQL fragment in addition to the results.
3838/// - query: A statement.
39- /// - database: The database to read from . A value of `nil` will use
39+ /// - database: The database to use . A value of `nil` will use
4040/// `@Dependency(\.defaultDatabase)`.
4141/// - sql: A snapshot of the SQL produced by the statement.
4242/// - results: A snapshot of the results.
43- /// to `1` for invoking this helper directly, but if you write a wrapper function that automates
44- /// the `execute` trailing closure, you should pass `0` instead.
4543/// - fileID: The source `#fileID` associated with the assertion.
4644/// - filePath: The source `#filePath` associated with the assertion.
4745/// - function: The source `#function` associated with the assertion
@@ -52,7 +50,7 @@ import StructuredQueriesTestSupport
5250public func assertQuery< each V : QueryRepresentable , S: StructuredQueriesCore . Statement < ( repeat each V ) > > (
5351 includeSQL: Bool = false ,
5452 _ query: S ,
55- database: ( any DatabaseReader ) ? = nil ,
53+ database: ( any DatabaseWriter ) ? = nil ,
5654 sql: ( ( ) -> String ) ? = nil ,
5755 results: ( ( ) -> String ) ? = nil ,
5856 fileID: StaticString = #fileID,
@@ -80,7 +78,7 @@ public func assertQuery<each V: QueryRepresentable, S: StructuredQueriesCore.Sta
8078 }
8179 do {
8280 @Dependency ( \. defaultDatabase) var defaultDatabase
83- let rows = try ( database ?? defaultDatabase) . read { try query. fetchAll ( $0) }
81+ let rows = try ( database ?? defaultDatabase) . write { try query. fetchAll ( $0) }
8482 var table = " "
8583 printTable ( rows, to: & table)
8684 if !table. isEmpty {
@@ -165,11 +163,9 @@ public func assertQuery<each V: QueryRepresentable, S: StructuredQueriesCore.Sta
165163/// - includeSQL: Whether to snapshot the SQL fragment in addition to the results.
166164/// - query: A statement.
167165/// - sql: A snapshot of the SQL produced by the statement.
168- /// - database: The database to read from . A value of `nil` will use
166+ /// - database: The database to use . A value of `nil` will use
169167/// `@Dependency(\.defaultDatabase)`.
170168/// - results: A snapshot of the results.
171- /// to `1` for invoking this helper directly, but if you write a wrapper function that automates
172- /// the `execute` trailing closure, you should pass `0` instead.
173169/// - fileID: The source `#fileID` associated with the assertion.
174170/// - filePath: The source `#filePath` associated with the assertion.
175171/// - function: The source `#function` associated with the assertion
@@ -179,7 +175,7 @@ public func assertQuery<each V: QueryRepresentable, S: StructuredQueriesCore.Sta
179175public func assertQuery< S: SelectStatement , each J : StructuredQueriesCore . Table > (
180176 includeSQL: Bool = false ,
181177 _ query: S ,
182- database: ( any DatabaseReader ) ? = nil ,
178+ database: ( any DatabaseWriter ) ? = nil ,
183179 sql: ( ( ) -> String ) ? = nil ,
184180 results: ( ( ) -> String ) ? = nil ,
185181 fileID: StaticString = #fileID,
0 commit comments