Extend the example

This commit is contained in:
Ivan Ukhov 2015-07-04 09:27:13 -04:00
parent 0572f80ed0
commit 961dad0f65
2 changed files with 12 additions and 0 deletions

View File

@ -20,6 +20,12 @@ connection.process("SELECT * FROM `users`;", |pairs| {
} }
true true
}).unwrap(); }).unwrap();
let mut statement = connection.prepare("SELECT * FROM `users`;").unwrap();
while statement.step().unwrap() == sqlite::State::Row {
println!("id = {}", statement.read::<i64>(0).unwrap());
println!("name = {}", statement.read::<String>(1).unwrap());
}
``` ```
## Contributing ## Contributing

View File

@ -16,6 +16,12 @@
//! } //! }
//! true //! true
//! }).unwrap(); //! }).unwrap();
//!
//! let mut statement = connection.prepare("SELECT * FROM `users`;").unwrap();
//! while statement.step().unwrap() == sqlite::State::Row {
//! println!("id = {}", statement.read::<i64>(0).unwrap());
//! println!("name = {}", statement.read::<String>(1).unwrap());
//! }
//! ``` //! ```
//! //!
//! [1]: https://www.sqlite.org //! [1]: https://www.sqlite.org