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
2,801 downloads per month
Used in 13 crates
(4 directly)
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