Generator implementing `Connection.commit()`.
(self)
| 568 | return self._begin_statement |
| 569 | |
| 570 | def _commit_gen(self) -> PQGen[None]: |
| 571 | """Generator implementing `Connection.commit()`.""" |
| 572 | if self._num_transactions: |
| 573 | raise e.ProgrammingError( |
| 574 | "Explicit commit() forbidden within a Transaction " |
| 575 | "context. (Transaction will be automatically committed " |
| 576 | "on successful exit from context.)" |
| 577 | ) |
| 578 | if self._tpc: |
| 579 | raise e.ProgrammingError( |
| 580 | "commit() cannot be used during a two-phase transaction" |
| 581 | ) |
| 582 | if self.pgconn.transaction_status == IDLE: |
| 583 | return |
| 584 | |
| 585 | yield from self._exec_command(b"COMMIT") |
| 586 | |
| 587 | if self._pipeline: |
| 588 | yield from self._pipeline._sync_gen() |
| 589 | |
| 590 | def _rollback_gen(self) -> PQGen[None]: |
| 591 | """Generator implementing `Connection.rollback()`.""" |
nothing calls this directly
no test coverage detected