ResultSet
public class ResultSet
Represents a query result set. The rows are accessable either in a blocking fashion using a RowSequence
or in a non-blocking fashion using nextRow() function.
-
Instantiate an instance of ResultSet.
Declaration
Swift
public init(_ resultFetcher: ResultFetcher, connection: Connection)
Parameters
resultFetcher
An implementation of
ResultFetcher
protocol to fetch the query results. -
Fetch the next row of the query result. This function is non-blocking.
Declaration
Swift
public func nextRow(callback: @escaping (([Any?]?, Error?)) -> ())
Parameters
callback
A callback to call when the next row of the query result is ready.
-
Fetch the column titles of the query result. This function is non-blocking
Declaration
Swift
public func getColumnTitles(callback: @escaping (([String]?, Error?)) -> ())
-
Called to indicate no further operations will be called on the result set. A ResultSet will keep a connection alive until this method is called. When called this method enables the underlying connection to be released and in the case where a connection pool is used, returned to the pool for reuse.
Declaration
Swift
public func done()
-
Type alias for closures to be passed to the forEach method
Declaration
Swift
public typealias RowOperation = ([Any?]?, Error?) -> Void
-
Type alias for closures to be passed to the forEach method which allows asynchronous opertions.
Declaration
Swift
public typealias RowOperationWithNext = ([Any?]?, Error?, () -> Void) -> Void
-
Execute the supplied RowOperation against each row returned from the database
Declaration
Swift
public func forEach(operation: @escaping RowOperation)
Parameters
operation
A callback to be executed against each row in the result set.
-
Execute the supplied RowOperation against each row returned from the database
Declaration
Swift
public func forEach(operation: @escaping RowOperationWithNext)
Parameters
operation
A callback to be executed against each row in the result set.