Always succeed when calling Statement::cursor

This commit is contained in:
Ivan Ukhov 2015-08-03 21:21:44 -04:00
parent fd9c9a0a25
commit 22aea1100f
6 changed files with 7 additions and 7 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "sqlite"
version = "0.19.1"
version = "0.19.2"
authors = ["Ivan Ukhov <ivan.ukhov@gmail.com>"]
license = "MIT"
repository = "https://github.com/stainless-steel/sqlite"

View File

@ -54,7 +54,7 @@ use sqlite::Value;
let mut cursor = connection.prepare("
SELECT * FROM users WHERE age > ?
").unwrap().cursor().unwrap();
").unwrap().cursor();
cursor.bind(&[Value::Integer(50)]).unwrap();

View File

@ -52,6 +52,6 @@ impl<'l> Cursor<'l> {
}
#[inline]
pub fn new<'l>(statement: Statement<'l>) -> Result<Cursor<'l>> {
Ok(Cursor { state: None, values: None, statement: statement })
pub fn new<'l>(statement: Statement<'l>) -> Cursor<'l> {
Cursor { state: None, values: None, statement: statement }
}

View File

@ -68,7 +68,7 @@
//!
//! let mut cursor = connection.prepare("
//! SELECT * FROM users WHERE age > ?
//! ").unwrap().cursor().unwrap();
//! ").unwrap().cursor();
//!
//! cursor.bind(&[Value::Integer(50)]).unwrap();
//!

View File

@ -103,7 +103,7 @@ impl<'l> Statement<'l> {
/// Upgrade to a cursor.
#[inline]
pub fn cursor(self) -> Result<Cursor<'l>> {
pub fn cursor(self) -> Cursor<'l> {
::cursor::new(self)
}
}

View File

@ -73,7 +73,7 @@ fn connection_set_busy_handler() {
fn cursor() {
let connection = setup(":memory:");
let statement = "SELECT id, name FROM users WHERE id = ?";
let mut cursor = ok!(connection.prepare(statement)).cursor().unwrap();
let mut cursor = ok!(connection.prepare(statement)).cursor();
ok!(cursor.bind(&[Value::Integer(1)]));
assert_eq!(ok!(ok!(cursor.next())), &[Value::Integer(1), Value::String("Alice".to_string())]);