From ae4fcd1406d222ca1060af800a114cdf52c1e4c9 Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Wed, 15 Jan 2020 01:32:16 -0800 Subject: [PATCH] Work around bug with format! and await on stable --- sqlx-core/src/transaction.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sqlx-core/src/transaction.rs b/sqlx-core/src/transaction.rs index be3e43a0..af01439d 100644 --- a/sqlx-core/src/transaction.rs +++ b/sqlx-core/src/transaction.rs @@ -25,8 +25,10 @@ where if depth == 0 { inner.send("BEGIN").await?; } else { + let stmt = format!("SAVEPOINT _sqlx_savepoint_{}", depth); + inner - .send(&format!("SAVEPOINT _sqlx_savepoint_{}", depth)) + .send(&stmt) .await?; } @@ -47,8 +49,10 @@ where if depth == 1 { inner.send("COMMIT").await?; } else { + let stmt = format!("RELEASE SAVEPOINT _sqlx_savepoint_{}", depth - 1); + inner - .send(&format!("RELEASE SAVEPOINT _sqlx_savepoint_{}", depth - 1)) + .send(&stmt) .await?; } @@ -62,11 +66,13 @@ where if depth == 1 { inner.send("ROLLBACK").await?; } else { + let stmt = format!( + "ROLLBACK TO SAVEPOINT _sqlx_savepoint_{}", + depth - 1 + ); + inner - .send(&format!( - "ROLLBACK TO SAVEPOINT _sqlx_savepoint_{}", - depth - 1 - )) + .send(&stmt) .await?; }