50 lines
1.2 KiB
Markdown
Raw Normal View History

2015-06-03 22:14:48 -04:00
# SQLite [![Version][version-img]][version-url] [![Status][status-img]][status-url]
2015-05-28 17:21:43 -04:00
The package provides an interface to [SQLite][1].
2015-05-28 17:24:45 -04:00
## [Documentation][doc]
2015-05-29 09:25:39 -04:00
## Example
The example given below can be ran using the following command:
```
cargo run --example workflow
```
```rust
extern crate sqlite;
2015-06-14 11:33:55 -04:00
use std::path::Path;
2015-05-29 09:25:39 -04:00
fn main() {
2015-06-14 11:33:55 -04:00
let database = sqlite::open(&Path::new(":memory:")).unwrap();
2015-05-29 09:25:39 -04:00
database.execute(r#"
2015-05-29 09:25:39 -04:00
CREATE TABLE `users` (id INTEGER, name VARCHAR(255));
INSERT INTO `users` (id, name) VALUES (1, 'Alice');
"#).unwrap();
2015-05-29 09:25:39 -04:00
database.process("SELECT * FROM `users`;", |pairs| {
for &(column, value) in pairs.iter() {
println!("{} = {}", column, value.unwrap());
2015-05-29 09:25:39 -04:00
}
true
}).unwrap();
2015-05-29 09:25:39 -04:00
}
```
2015-05-28 17:21:43 -04:00
## Contributing
1. Fork the project.
2. Implement your idea.
3. Open a pull request.
[1]: https://www.sqlite.org
2015-05-28 17:24:45 -04:00
2015-06-03 22:14:48 -04:00
[version-img]: https://img.shields.io/crates/v/sqlite.svg
[version-url]: https://crates.io/crates/sqlite
2015-05-28 17:24:45 -04:00
[status-img]: https://travis-ci.org/stainless-steel/sqlite.svg?branch=master
[status-url]: https://travis-ci.org/stainless-steel/sqlite
[doc]: https://stainless-steel.github.io/sqlite