From 961dad0f65cab7184be2e5616b248fa1d12abf96 Mon Sep 17 00:00:00 2001 From: Ivan Ukhov Date: Sat, 4 Jul 2015 09:27:13 -0400 Subject: [PATCH] Extend the example --- README.md | 6 ++++++ src/lib.rs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 204e558..97c6278 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,12 @@ connection.process("SELECT * FROM `users`;", |pairs| { } true }).unwrap(); + +let mut statement = connection.prepare("SELECT * FROM `users`;").unwrap(); +while statement.step().unwrap() == sqlite::State::Row { + println!("id = {}", statement.read::(0).unwrap()); + println!("name = {}", statement.read::(1).unwrap()); +} ``` ## Contributing diff --git a/src/lib.rs b/src/lib.rs index 2c673ff..a38079d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,6 +16,12 @@ //! } //! true //! }).unwrap(); +//! +//! let mut statement = connection.prepare("SELECT * FROM `users`;").unwrap(); +//! while statement.step().unwrap() == sqlite::State::Row { +//! println!("id = {}", statement.read::(0).unwrap()); +//! println!("name = {}", statement.read::(1).unwrap()); +//! } //! ``` //! //! [1]: https://www.sqlite.org