mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 06:24:16 +00:00
fix tests/mysql-macros.rs
This commit is contained in:
parent
140d9cb061
commit
02075c74bd
1 changed files with 11 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
|||
use sqlx::MySqlConnection;
|
||||
|
||||
#[cfg_attr(feature = "runtime-async-std", async_std::test)]
|
||||
#[cfg_attr(feature = "runtime-tokio", tokio::test)]
|
||||
async fn macro_select_from_cte() -> anyhow::Result<()> {
|
||||
|
@ -43,7 +45,7 @@ async fn test_query_as_raw() -> anyhow::Result<()> {
|
|||
|
||||
let account = sqlx::query_as!(
|
||||
RawAccount,
|
||||
"SELECT * from (VALUES (1, null)) accounts(type, name)"
|
||||
"SELECT * from (select 1 as type, cast(null as char) as name) accounts"
|
||||
)
|
||||
.fetch_one(&mut conn)
|
||||
.await?;
|
||||
|
@ -55,3 +57,11 @@ async fn test_query_as_raw() -> anyhow::Result<()> {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn url() -> anyhow::Result<String> {
|
||||
Ok(dotenv::var("DATABASE_URL")?)
|
||||
}
|
||||
|
||||
async fn connect() -> anyhow::Result<MySqlConnection> {
|
||||
Ok(MySqlConnection::open(url()?).await?)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue