()
| 591 | |
| 592 | #[tokio::test(flavor = "multi_thread", worker_threads = 2)] |
| 593 | async fn tokio_postgres_prepared_statement_reuse_works() -> Result<()> { |
| 594 | let server = PgliteServer::temporary_tcp()?; |
| 595 | let (client, connection) = tokio_postgres::connect(&server.connection_uri(), NoTls) |
| 596 | .await |
| 597 | .context("connect with tokio-postgres")?; |
| 598 | let connection_task = tokio::spawn(connection); |
| 599 | |
| 600 | let statement = client.prepare("SELECT $1::int4 + $2::int4 AS sum").await?; |
| 601 | for value in [1_i32, 10, 40] { |
| 602 | let row = client.query_one(&statement, &[&value, &2_i32]).await?; |
| 603 | assert_eq!(row.get::<_, i32>("sum"), value + 2); |
| 604 | } |
| 605 | |
| 606 | drop(client); |
| 607 | wait_for_tokio_postgres(connection_task).await?; |
| 608 | server.shutdown()?; |
| 609 | Ok(()) |
| 610 | } |
| 611 | |
| 612 | #[tokio::test(flavor = "multi_thread", worker_threads = 2)] |
| 613 | async fn sqlx_transaction_error_recovers_after_rollback() -> Result<()> { |
nothing calls this directly
no test coverage detected