(mut self)
| 157 | #[instrument(level = "trace")] |
| 158 | #[allow(unreachable_code, unused_mut)] |
| 159 | pub async fn rollback(mut self) -> Result<(), DbErr> { |
| 160 | match *self.conn.lock().await { |
| 161 | #[cfg(feature = "sqlx-mysql")] |
| 162 | InnerConnection::MySql(ref mut c) => { |
| 163 | <sqlx::MySql as sqlx::Database>::TransactionManager::rollback(c) |
| 164 | .await |
| 165 | .map_err(sqlx_error_to_query_err) |
| 166 | } |
| 167 | #[cfg(feature = "sqlx-postgres")] |
| 168 | InnerConnection::Postgres(ref mut c) => { |
| 169 | <sqlx::Postgres as sqlx::Database>::TransactionManager::rollback(c) |
| 170 | .await |
| 171 | .map_err(sqlx_error_to_query_err) |
| 172 | } |
| 173 | #[cfg(feature = "sqlx-sqlite")] |
| 174 | InnerConnection::Sqlite(ref mut c) => { |
| 175 | <sqlx::Sqlite as sqlx::Database>::TransactionManager::rollback(c) |
| 176 | .await |
| 177 | .map_err(sqlx_error_to_query_err) |
| 178 | } |
| 179 | #[cfg(feature = "mock")] |
| 180 | InnerConnection::Mock(ref mut c) => { |
| 181 | c.rollback(); |
| 182 | Ok(()) |
| 183 | } |
| 184 | #[cfg(feature = "proxy")] |
| 185 | InnerConnection::Proxy(ref mut c) => { |
| 186 | c.rollback().await; |
| 187 | Ok(()) |
| 188 | } |
| 189 | #[allow(unreachable_patterns)] |
| 190 | _ => Err(conn_err("Disconnected")), |
| 191 | }?; |
| 192 | self.open = false; |
| 193 | Ok(()) |
| 194 | } |
| 195 | |
| 196 | // the rollback is queued and will be performed on next async operation, like returning the connection to the pool |
| 197 | #[instrument(level = "trace")] |
no test coverage detected