From 02075c74bdeb7ef584f88e6f753d702a539ef362 Mon Sep 17 00:00:00 2001 From: Austin Bonander Date: Tue, 28 Jan 2020 19:53:17 -0800 Subject: [PATCH] fix `tests/mysql-macros.rs` --- tests/mysql-macros.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/mysql-macros.rs b/tests/mysql-macros.rs index 6d5d4117f..28b197433 100644 --- a/tests/mysql-macros.rs +++ b/tests/mysql-macros.rs @@ -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 { + Ok(dotenv::var("DATABASE_URL")?) +} + +async fn connect() -> anyhow::Result { + Ok(MySqlConnection::open(url()?).await?) +}