From 22aea1100ffaa9c808e6ac135d4ef673a214caa4 Mon Sep 17 00:00:00 2001 From: Ivan Ukhov Date: Mon, 3 Aug 2015 21:21:44 -0400 Subject: [PATCH] Always succeed when calling Statement::cursor --- Cargo.toml | 2 +- README.md | 2 +- src/cursor.rs | 4 ++-- src/lib.rs | 2 +- src/statement.rs | 2 +- tests/lib.rs | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5bb0eca..477641b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sqlite" -version = "0.19.1" +version = "0.19.2" authors = ["Ivan Ukhov "] license = "MIT" repository = "https://github.com/stainless-steel/sqlite" diff --git a/README.md b/README.md index 1cb7a16..027d009 100644 --- a/README.md +++ b/README.md @@ -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(); diff --git a/src/cursor.rs b/src/cursor.rs index cbcde74..1ccab70 100644 --- a/src/cursor.rs +++ b/src/cursor.rs @@ -52,6 +52,6 @@ impl<'l> Cursor<'l> { } #[inline] -pub fn new<'l>(statement: Statement<'l>) -> Result> { - Ok(Cursor { state: None, values: None, statement: statement }) +pub fn new<'l>(statement: Statement<'l>) -> Cursor<'l> { + Cursor { state: None, values: None, statement: statement } } diff --git a/src/lib.rs b/src/lib.rs index 3068ff5..5076490 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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(); //! diff --git a/src/statement.rs b/src/statement.rs index 56e3c42..a1c4bed 100644 --- a/src/statement.rs +++ b/src/statement.rs @@ -103,7 +103,7 @@ impl<'l> Statement<'l> { /// Upgrade to a cursor. #[inline] - pub fn cursor(self) -> Result> { + pub fn cursor(self) -> Cursor<'l> { ::cursor::new(self) } } diff --git a/tests/lib.rs b/tests/lib.rs index 801c2dd..4d1f007 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -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())]);