* Submit a query and wait for the result. * * This function is interruptible by signals. * * Caller is responsible for the error handling on the result. */
| 680 | * Caller is responsible for the error handling on the result. |
| 681 | */ |
| 682 | PGresult * |
| 683 | pgfdw_exec_query(PGconn *conn, const char *query, PgFdwConnState *state) |
| 684 | { |
| 685 | /* First, process a pending asynchronous request, if any. */ |
| 686 | if (state && state->pendingAreq) |
| 687 | process_pending_request(state->pendingAreq); |
| 688 | |
| 689 | /* |
| 690 | * Submit a query. Since we don't use non-blocking mode, this also can |
| 691 | * block. But its risk is relatively small, so we ignore that for now. |
| 692 | */ |
| 693 | if (!PQsendQuery(conn, query)) |
| 694 | pgfdw_report_error(ERROR, NULL, conn, false, query); |
| 695 | |
| 696 | /* Wait for the result. */ |
| 697 | return pgfdw_get_result(conn, query); |
| 698 | } |
| 699 | |
| 700 | /* |
| 701 | * Wait for the result from a prior asynchronous execution function call. |
no test coverage detected