mirror of
https://github.com/isar/rusqlite.git
synced 2025-10-16 07:22:26 +08:00
Refactor: Extract match to get an expected row into its own method.
This commit is contained in:
@@ -48,15 +48,7 @@ impl SqliteConnection {
|
||||
let mut stmt = try!(self.prepare(sql));
|
||||
let mut rows = try!(stmt.query_named(params));
|
||||
|
||||
match rows.next() {
|
||||
Some(row) => row.map(f),
|
||||
None => {
|
||||
Err(SqliteError {
|
||||
code: ffi::SQLITE_NOTICE,
|
||||
message: "Query did not return a row".to_string(),
|
||||
})
|
||||
}
|
||||
}
|
||||
rows.get_expected_row().map(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user