---------- * exec_stmt_fors Execute a query, assign each * tuple to a record or row and * execute a group of statements * for it. * ---------- */
| 2780 | * ---------- |
| 2781 | */ |
| 2782 | static int |
| 2783 | exec_stmt_fors(PLpgSQL_execstate *estate, PLpgSQL_stmt_fors *stmt) |
| 2784 | { |
| 2785 | Portal portal; |
| 2786 | int rc; |
| 2787 | |
| 2788 | /* |
| 2789 | * Open the implicit cursor for the statement using exec_run_select |
| 2790 | */ |
| 2791 | exec_run_select(estate, stmt->query, 0, &portal); |
| 2792 | |
| 2793 | /* |
| 2794 | * Execute the loop |
| 2795 | */ |
| 2796 | rc = exec_for_query(estate, (PLpgSQL_stmt_forq *) stmt, portal, true); |
| 2797 | |
| 2798 | /* |
| 2799 | * Close the implicit cursor |
| 2800 | */ |
| 2801 | SPI_cursor_close(portal); |
| 2802 | |
| 2803 | return rc; |
| 2804 | } |
| 2805 | |
| 2806 | |
| 2807 | /* ---------- |
no test coverage detected