This will fail loll

This commit is contained in:
Billy Chan 2021-11-08 22:29:18 +08:00
parent afdb1afeb8
commit 17232063b3
No known key found for this signature in database
GPG Key ID: A2D690CAC7DF3CC7
4 changed files with 19 additions and 2 deletions

View File

@ -517,7 +517,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
version: [13.3, 12.7, 11.12, 10.17, 9.6.22] version: [13, 12, 11, 10, 9]
runtime: [tokio] runtime: [tokio]
tls: [native-tls] tls: [native-tls]
services: services:

View File

@ -269,6 +269,22 @@ impl DatabaseConnection {
} }
impl DatabaseConnection { impl DatabaseConnection {
/// Get database version
pub fn version(&self) -> String {
match self {
#[cfg(feature = "sqlx-mysql")]
DatabaseConnection::SqlxMySqlPoolConnection { version, .. } => version.to_string(),
#[cfg(feature = "sqlx-postgres")]
DatabaseConnection::SqlxPostgresPoolConnection(_) => "".to_string(),
#[cfg(feature = "sqlx-sqlite")]
DatabaseConnection::SqlxSqlitePoolConnection(_) => "".to_string(),
#[cfg(feature = "mock")]
DatabaseConnection::MockDatabaseConnection(_) => "".to_string(),
DatabaseConnection::Disconnected => panic!("Disconnected"),
_ => unimplemented!(),
}
}
/// Check if database supports `RETURNING` /// Check if database supports `RETURNING`
pub fn support_returning(&self) -> bool { pub fn support_returning(&self) -> bool {
match self { match self {

View File

@ -221,6 +221,6 @@ async fn into_db_connection(pool: MySqlPool) -> Result<DatabaseConnection, DbErr
Ok(DatabaseConnection::SqlxMySqlPoolConnection { Ok(DatabaseConnection::SqlxMySqlPoolConnection {
conn, conn,
version, version,
support_returning: false, support_returning,
}) })
} }

View File

@ -40,6 +40,7 @@ async fn main() -> Result<(), DbErr> {
} }
create_tables(db).await?; create_tables(db).await?;
println!("db_version: {:#?}", db.version());
db.query_one(builder.build(&insert)).await?; db.query_one(builder.build(&insert)).await?;
db.query_one(builder.build(&update)).await?; db.query_one(builder.build(&update)).await?;
assert!(false); assert!(false);