Expand description
§Sqlite support for the r2d2
connection pool.
Library crate: r2d2-sqlite
Integrated with: r2d2 and rusqlite
§Example
extern crate r2d2;
extern crate r2d2_sqlite3;
extern crate sqlite3;
use std::thread;
use r2d2_sqlite3::SqliteConnectionManager;
fn main() {
let manager = SqliteConnectionManager::file("file.db");
let pool = r2d2::Pool::builder().build(manager).unwrap();
for i in 0..10i32 {
let pool = pool.clone();
thread::spawn(move || {
let conn = pool.get().unwrap();
let mut stmt = conn.prepare("INSERT INTO foo (bar) VALUES (?)").unwrap();
stmt.bind(1, 42).unwrap();
});
}
}
Structs§
- An
r2d2::ManageConnection
forrusqlite::Connection
s.