mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 19:41:37 +08:00
Reset as soon as possible.
This commit is contained in:
parent
234624ae5c
commit
9fefa372db
@ -24,11 +24,15 @@ impl<'conn> Statement<'conn> {
|
|||||||
/// and `false` if the SQL returns an empty set.
|
/// and `false` if the SQL returns an empty set.
|
||||||
pub fn exists(&mut self, params: &[&ToSql]) -> Result<bool> {
|
pub fn exists(&mut self, params: &[&ToSql]) -> Result<bool> {
|
||||||
self.reset_if_needed();
|
self.reset_if_needed();
|
||||||
|
let exists = {
|
||||||
let mut rows = try!(self.query(params));
|
let mut rows = try!(self.query(params));
|
||||||
match rows.next() {
|
match rows.next() {
|
||||||
Some(_) => Ok(true),
|
Some(_) => Ok(true),
|
||||||
None => Ok(false),
|
None => Ok(false),
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
self.reset_if_needed();
|
||||||
|
return exists;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user