add mssql

This commit is contained in:
2021-08-19 21:40:06 -05:00
parent 50e78602f3
commit fe01037749
6 changed files with 127 additions and 98 deletions

26
src/check_sqlite.rs Normal file
View File

@@ -0,0 +1,26 @@
use log::info;
use sqlx::sqlite::SqlitePoolOptions;
pub async fn check_sqlite() -> Result<(), sqlx::Error> {
// Create a connection pool
// for MySQL, use MySqlPoolOptions::new()
// for SQLite, use SqlitePoolOptions::new()
// etc.
let pool = SqlitePoolOptions::new()
.max_connections(5)
.connect("sqlite://test.db")
.await?;
// Make a simple query to return the given parameter
let row: (i64,) = sqlx::query_as("SELECT $1")
.bind(150_i64)
.fetch_one(&pool)
.await?;
assert_eq!(row.0, 150);
info!("Received {}", row.0);
Ok(())
}