Crate r2d2_sqlite3 [] [src]

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 sqlite;

use std::thread;
use r2d2_sqlite3::SqliteConnectionManager;

fn main() {
    let config = r2d2::Config::default();
    let manager = SqliteConnectionManager::file("file.db");
    let pool = r2d2::Pool::new(config, 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

SqliteConnectionManager

An r2d2::ManageConnection for rusqlite::Connections.