Generator implementing `Connection.rollback()`.
(self)
| 588 | yield from self._pipeline._sync_gen() |
| 589 | |
| 590 | def _rollback_gen(self) -> PQGen[None]: |
| 591 | """Generator implementing `Connection.rollback()`.""" |
| 592 | if self._num_transactions: |
| 593 | raise e.ProgrammingError( |
| 594 | "Explicit rollback() forbidden within a Transaction " |
| 595 | "context. (Either raise Rollback() or allow " |
| 596 | "an exception to propagate out of the context.)" |
| 597 | ) |
| 598 | if self._tpc: |
| 599 | raise e.ProgrammingError( |
| 600 | "rollback() cannot be used during a two-phase transaction" |
| 601 | ) |
| 602 | |
| 603 | # Get out of a "pipeline aborted" state |
| 604 | if self._pipeline: |
| 605 | yield from self._pipeline._sync_gen() |
| 606 | |
| 607 | if self.pgconn.transaction_status == IDLE: |
| 608 | return |
| 609 | |
| 610 | yield from self._exec_command(b"ROLLBACK") |
| 611 | self._prepared.clear() |
| 612 | yield from self._prepared.maintain_gen(self) |
| 613 | |
| 614 | if self._pipeline: |
| 615 | yield from self._pipeline._sync_gen() |
| 616 | |
| 617 | def xid(self, format_id: int, gtrid: str, bqual: str) -> Xid: |
| 618 | """ |
nothing calls this directly
no test coverage detected