(
conn: &mut sqlx::PgConnection,
sql: &'static str,
values: PreparedUpdateValues<'_>,
)
| 2858 | } |
| 2859 | |
| 2860 | async fn measure_async_transaction_sqlx( |
| 2861 | conn: &mut sqlx::PgConnection, |
| 2862 | sql: &'static str, |
| 2863 | values: PreparedUpdateValues<'_>, |
| 2864 | ) -> Result<Duration> { |
| 2865 | let started = Instant::now(); |
| 2866 | conn.execute("BEGIN") |
| 2867 | .await |
| 2868 | .context("begin SQLx transaction")?; |
| 2869 | match values { |
| 2870 | PreparedUpdateValues::Numeric(values) => { |
| 2871 | for (lookup, value) in values { |
| 2872 | sqlx::query(sql) |
| 2873 | .bind(*value) |
| 2874 | .bind(*lookup) |
| 2875 | .execute(&mut *conn) |
| 2876 | .await |
| 2877 | .context("execute SQLx prepared numeric update")?; |
| 2878 | } |
| 2879 | } |
| 2880 | PreparedUpdateValues::Text(values) => { |
| 2881 | for (lookup, value) in values { |
| 2882 | sqlx::query(sql) |
| 2883 | .bind(value.as_str()) |
| 2884 | .bind(*lookup) |
| 2885 | .execute(&mut *conn) |
| 2886 | .await |
| 2887 | .context("execute SQLx prepared text update")?; |
| 2888 | } |
| 2889 | } |
| 2890 | } |
| 2891 | conn.execute("COMMIT") |
| 2892 | .await |
| 2893 | .context("commit SQLx transaction")?; |
| 2894 | Ok(started.elapsed()) |
| 2895 | } |
| 2896 | |
| 2897 | fn run_pglite_tokio_prepared_update_tests( |
| 2898 | numeric_updates: &[(i32, i32)], |
no test coverage detected