mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 23:35:20 +00:00
fix: found a few more changes needed in internal core usage in macros
This commit is contained in:
parent
9b299d9f09
commit
d4d994bae4
@ -73,7 +73,7 @@ macro_rules! impl_database_ext {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_feature_gate($name: &Self::TypeInfo) -> Option<&'static str> {
|
||||
fn get_feature_gate($ty_info: &Self::TypeInfo) -> Option<&'static str> {
|
||||
$get_gate
|
||||
}
|
||||
}
|
||||
|
@ -62,12 +62,15 @@ pub fn expand_input(input: QueryMacroInput) -> crate::Result<TokenStream> {
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn expand_from_db(input: QueryMacroInput, db_url: &str) -> crate::Result<TokenStream> {
|
||||
// FIXME: Introduce [sqlx::any::AnyConnection] and [sqlx::any::AnyDatabase] to support
|
||||
// runtime determinism here
|
||||
|
||||
let db_url = Url::parse(db_url)?;
|
||||
match db_url.scheme() {
|
||||
#[cfg(feature = "postgres")]
|
||||
"postgres" | "postgresql" => {
|
||||
let data = block_on(async {
|
||||
let mut conn = sqlx_core::postgres::PgConnection::connect(db_url).await?;
|
||||
let mut conn = sqlx_core::postgres::PgConnection::connect(db_url.as_str()).await?;
|
||||
QueryData::from_db(&mut conn, &input.src).await
|
||||
})?;
|
||||
|
||||
@ -78,7 +81,7 @@ fn expand_from_db(input: QueryMacroInput, db_url: &str) -> crate::Result<TokenSt
|
||||
#[cfg(feature = "mysql")]
|
||||
"mysql" | "mariadb" => {
|
||||
let data = block_on(async {
|
||||
let mut conn = sqlx_core::mysql::MySqlConnection::connect(db_url).await?;
|
||||
let mut conn = sqlx_core::mysql::MySqlConnection::connect(db_url.as_str()).await?;
|
||||
QueryData::from_db(&mut conn, &input.src).await
|
||||
})?;
|
||||
|
||||
@ -89,7 +92,7 @@ fn expand_from_db(input: QueryMacroInput, db_url: &str) -> crate::Result<TokenSt
|
||||
#[cfg(feature = "sqlite")]
|
||||
"sqlite" => {
|
||||
let data = block_on(async {
|
||||
let mut conn = sqlx_core::sqlite::SqliteConnection::connect(db_url).await?;
|
||||
let mut conn = sqlx_core::sqlite::SqliteConnection::connect(db_url.as_str()).await?;
|
||||
QueryData::from_db(&mut conn, &input.src).await
|
||||
})?;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user