Add query_row_named for prepared statement.

This commit is contained in:
gwenn
2019-06-12 19:18:57 +02:00
parent ec319b32bb
commit 031bffffa5
2 changed files with 29 additions and 9 deletions

View File

@@ -537,9 +537,7 @@ impl Connection {
F: FnOnce(&Row<'_>) -> Result<T>,
{
let mut stmt = self.prepare(sql)?;
let mut rows = stmt.query_named(params)?;
rows.get_expected_row().and_then(|r| f(&r))
stmt.query_row_named(params, f)
}
/// Convenience method to execute a query that is expected to return a