14 releases (breaking)

0.15.0 Feb 14, 2023
0.13.0 Sep 7, 2022
0.12.0 Jul 27, 2022
0.9.0 Mar 29, 2022
0.1.0 Jul 11, 2019

#1538 in Database interfaces

Download history 898/week @ 2024-07-21 760/week @ 2024-07-28 739/week @ 2024-08-04 777/week @ 2024-08-11 521/week @ 2024-08-18 498/week @ 2024-08-25 589/week @ 2024-09-01 604/week @ 2024-09-08 382/week @ 2024-09-15 566/week @ 2024-09-22 448/week @ 2024-09-29 623/week @ 2024-10-06 537/week @ 2024-10-13 705/week @ 2024-10-20 613/week @ 2024-10-27 920/week @ 2024-11-03

2,801 downloads per month
Used in 13 crates (4 directly)

MIT license

13KB
148 lines

bb8-tiberius

Use bb8 (pool manager for async connections) with Tiberius (MSSQL driver for Rust).

Usage

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let conn_str = std::env::var("DB_CONN")?;

    let mgr = bb8_tiberius::ConnectionManager::build(conn_str.as_str())?;

    let pool = bb8::Pool::builder().max_size(2).build(mgr).await?;

    let mut conn = pool.get().await?;

    let res = conn
        .simple_query("SELECT @@version")
        .await?
        .into_first_result()
        .await?
        .into_iter()
        .map(|row| {
            let val: &str = row.get(0).unwrap();
            String::from(val)
        })
        .collect::<Vec<_>>();

    println!("{:?}", &res);

    Ok(())
}

Dependencies

~8–21MB
~374K SLoC