| 604 | ) |
| 605 | |
| 606 | def _check_result_for_fetch(self) -> PGresult: |
| 607 | if self.closed: |
| 608 | raise e.InterfaceError(class="st">"the cursor is closed") |
| 609 | |
| 610 | if not (res := self.pgresult): |
| 611 | raise e.ProgrammingError(class="st">"no result available") |
| 612 | |
| 613 | if (status := res.status) == TUPLES_OK: |
| 614 | return res |
| 615 | elif status == FATAL_ERROR: |
| 616 | raise e.error_from_result(res, encoding=self._encoding) |
| 617 | elif status == PIPELINE_ABORTED: |
| 618 | raise e.PipelineAborted(class="st">"pipeline aborted") |
| 619 | else: |
| 620 | if res.command_status: |
| 621 | detail = fclass="st">" (command status: {res.command_status.decode()})" |
| 622 | else: |
| 623 | try: |
| 624 | status_name = pq.ExecStatus(status).name |
| 625 | except ValueError: |
| 626 | status_name = fclass="st">"{status} - unknown" |
| 627 | detail = fclass="st">" (result status: {status_name})" |
| 628 | raise e.ProgrammingError( |
| 629 | fclass="st">"the last operation didn&class="cm">#x27;t produce records{detail}" |
| 630 | ) |
| 631 | |
| 632 | def _check_copy_result(self, result: PGresult) -> None: |
| 633 | class="st">""" |