pub struct SavePoint { /* private fields */ }Expand description
A savepoint within a transaction.
Savepoints allow partial rollbacks within a transaction. The savepoint name is validated when created to prevent SQL injection.
§Example
ⓘ
let mut tx = client.begin_transaction().await?;
tx.execute("INSERT INTO orders (customer_id) VALUES (@p1)", &[&42]).await?;
let sp = tx.save_point("before_items").await?;
tx.execute("INSERT INTO items (order_id, product_id) VALUES (@p1, @p2)", &[&1, &100]).await?;
// Oops, need to undo the items but keep the order
tx.rollback_to(&sp).await?;
// Continue with different items...
tx.commit().await?;Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SavePoint
impl RefUnwindSafe for SavePoint
impl Send for SavePoint
impl Sync for SavePoint
impl Unpin for SavePoint
impl UnwindSafe for SavePoint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more