Skip to content

sqlite support library for the r2d2 connection pool.

License

Notifications You must be signed in to change notification settings

gwenn/r2d2-sqlite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

R2D2-SQLite

Build Status dependency status

rusqlite support library for the r2d2 connection pool.

BEWARE: Not related to r2d2_sqlite nor r2d2-sqlite3 crates (Jul 5, 2015 vs Jul 22, 2015).

Example

use std::sync::Arc;
use std::thread;
use std::default::Default;
use r2d2::Pool;
use r2d2_sqlite::SQLiteConnectionManager;
use rusqlite::OpenFlags;

fn main() {
    let manager = SQLiteConnectionManager::new("sample.db",
                                               OpenFlags::SQLITE_OPEN_READ_WRITE);
    let pool = Arc::new(Pool::new(manager).unwrap());

    for i in 0..10i32 {
        let pool = pool.clone();
        thread::spawn(move || {
            let conn = pool.get().unwrap();
            conn.execute("INSERT INTO foo (bar) VALUES (?1)", &[&i]).unwrap();
        });
    }
}

About

sqlite support library for the r2d2 connection pool.

Topics

Resources

License

Stars

Watchers

Forks

Languages