Skip to content

Commit ae4fcd1

Browse files
committed
Work around bug with format! and await on stable
1 parent 8b321bf commit ae4fcd1

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

sqlx-core/src/transaction.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ where
2525
if depth == 0 {
2626
inner.send("BEGIN").await?;
2727
} else {
28+
let stmt = format!("SAVEPOINT _sqlx_savepoint_{}", depth);
29+
2830
inner
29-
.send(&format!("SAVEPOINT _sqlx_savepoint_{}", depth))
31+
.send(&stmt)
3032
.await?;
3133
}
3234

@@ -47,8 +49,10 @@ where
4749
if depth == 1 {
4850
inner.send("COMMIT").await?;
4951
} else {
52+
let stmt = format!("RELEASE SAVEPOINT _sqlx_savepoint_{}", depth - 1);
53+
5054
inner
51-
.send(&format!("RELEASE SAVEPOINT _sqlx_savepoint_{}", depth - 1))
55+
.send(&stmt)
5256
.await?;
5357
}
5458

@@ -62,11 +66,13 @@ where
6266
if depth == 1 {
6367
inner.send("ROLLBACK").await?;
6468
} else {
69+
let stmt = format!(
70+
"ROLLBACK TO SAVEPOINT _sqlx_savepoint_{}",
71+
depth - 1
72+
);
73+
6574
inner
66-
.send(&format!(
67-
"ROLLBACK TO SAVEPOINT _sqlx_savepoint_{}",
68-
depth - 1
69-
))
75+
.send(&stmt)
7076
.await?;
7177
}
7278

0 commit comments

Comments
 (0)