mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 15:25:32 +00:00
application name test
This commit is contained in:
parent
1ab815cc9b
commit
9b26d45344
@ -654,6 +654,26 @@ async fn it_closes_statement_from_cache_issue_470() -> anyhow::Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[sqlx_macros::test]
|
||||||
|
async fn it_sets_application_name() -> anyhow::Result<()> {
|
||||||
|
sqlx_test::setup_if_needed();
|
||||||
|
|
||||||
|
let mut options: PgConnectOptions = env::var("DATABASE_URL")?.parse().unwrap();
|
||||||
|
options = options.application_name("some-name");
|
||||||
|
|
||||||
|
let mut conn = PgConnection::connect_with(&options).await?;
|
||||||
|
|
||||||
|
let row = sqlx::query("select current_setting('application_name') as app_name")
|
||||||
|
.fetch_one(&mut conn)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let val: String = row.get("app_name");
|
||||||
|
|
||||||
|
assert_eq!("some-name", &val);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[sqlx_macros::test]
|
#[sqlx_macros::test]
|
||||||
async fn it_can_handle_parameter_status_message_issue_484() -> anyhow::Result<()> {
|
async fn it_can_handle_parameter_status_message_issue_484() -> anyhow::Result<()> {
|
||||||
new::<Postgres>().await?.execute("SET NAMES 'UTF8'").await?;
|
new::<Postgres>().await?.execute("SET NAMES 'UTF8'").await?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user