mirror of
https://github.com/isar/rusqlite.git
synced 2025-10-20 07:08:57 +08:00
Minor refactor to avoid needing to expose Statement::decode_result().
This commit is contained in:
16
src/lib.rs
16
src/lib.rs
@@ -906,19 +906,17 @@ impl<'stmt> Rows<'stmt> {
|
||||
/// or `query_and_then` instead, which return types that implement `Iterator`.
|
||||
pub fn next<'a>(&'a mut self) -> Option<Result<Row<'a, 'stmt>>> {
|
||||
self.stmt.and_then(|stmt| match stmt.step() {
|
||||
ffi::SQLITE_ROW => {
|
||||
Some(Ok(Row {
|
||||
stmt: stmt,
|
||||
phantom: PhantomData,
|
||||
}))
|
||||
}
|
||||
ffi::SQLITE_DONE => {
|
||||
Ok(true) => Some(Ok(Row {
|
||||
stmt: stmt,
|
||||
phantom: PhantomData,
|
||||
})),
|
||||
Ok(false) => {
|
||||
self.reset();
|
||||
None
|
||||
}
|
||||
code => {
|
||||
Err(err) => {
|
||||
self.reset();
|
||||
Some(Err(stmt.decode_result(code).unwrap_err()))
|
||||
Some(Err(err))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user