(self)
| 63 | return capabilities.has_pipeline() |
| 64 | |
| 65 | def _enter_gen(self) -> PQGen[None]: |
| 66 | capabilities.has_pipeline(check=True) |
| 67 | if self.level == 0: |
| 68 | self.pgconn.enter_pipeline_mode() |
| 69 | elif self.command_queue or self.pgconn.transaction_status == ACTIVE: |
| 70 | # Nested pipeline case. |
| 71 | # Transaction might be ACTIVE when the pipeline uses an "implicit |
| 72 | # transaction", typically in autocommit mode. But when entering a |
| 73 | # Psycopg transaction(), we expect the IDLE state. By sync()-ing, |
| 74 | # we make sure all previous commands are completed and the |
| 75 | # transaction gets back to IDLE. |
| 76 | yield from self._sync_gen() |
| 77 | self.level += 1 |
| 78 | |
| 79 | def _exit(self, exc: BaseException | None) -> None: |
| 80 | self.level -= 1 |
no test coverage detected