Instance Method
execute(sql:_:)
Requests that the given generic SQL query be serialized and executed on the database, and that the
onRow closure be invoked once for each result row the query returns (if any).@preconcurrency func execute(sql query: any SQLExpression, _ onRow: @escaping @Sendable (any SQLRow) -> ()) -> EventLoopFuture<Void>
Parameters
queryAn
SQLExpressionrepresenting a complete query to execute.onRowA closure which is invoked once for each result row returned by the query (if any).
Return Value
An EventLoopFuture.
Discussion
Although it is a protocol requirement for historical reasons, this is considered a legacy interface thanks to its reliance on EventLoopFuture. Implementers should implement both this method and execute(sql:_:) if they can, and users should use execute(sql:_:) whenever possible.
Default Implementations
SQLDatabase Implementations
execute(sql:_:)The default implementation forexecute(sql:_:).