add mssql
This commit is contained in:
26
src/check_sqlite.rs
Normal file
26
src/check_sqlite.rs
Normal 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(())
|
||||
}
|
||||
Reference in New Issue
Block a user