MCPcopy Create free account
hub / github.com/apache/cloudberry / fetch_more_data_begin

Function fetch_more_data_begin

contrib/postgres_fdw/postgres_fdw.c:7153–7175  ·  view source on GitHub ↗

* Begin an asynchronous data fetch. * * Note: this function assumes there is no currently-in-progress asynchronous * data fetch. * * Note: fetch_more_data must be called to fetch the result. */

Source from the content-addressed store, hash-verified

7151 * Note: fetch_more_data must be called to fetch the result.
7152 */
7153static void
7154fetch_more_data_begin(AsyncRequest *areq)
7155{
7156 ForeignScanState *node = (ForeignScanState *) areq->requestee;
7157 PgFdwScanState *fsstate = (PgFdwScanState *) node->fdw_state;
7158 char sql[64];
7159
7160 Assert(!fsstate->conn_state->pendingAreq);
7161
7162 /* Create the cursor synchronously. */
7163 if (!fsstate->cursor_exists)
7164 create_cursor(node);
7165
7166 /* We will send this query, but not wait for the response. */
7167 snprintf(sql, sizeof(sql), "FETCH %d FROM c%u",
7168 fsstate->fetch_size, fsstate->cursor_number);
7169
7170 if (PQsendQuery(fsstate->conn, sql) < 0)
7171 pgfdw_report_error(ERROR, NULL, fsstate->conn, false, fsstate->query);
7172
7173 /* Remember that the request is in process */
7174 fsstate->conn_state->pendingAreq = areq;
7175}
7176
7177/*
7178 * Process a pending asynchronous request.

Callers 2

Calls 3

create_cursorFunction · 0.85
PQsendQueryFunction · 0.85
pgfdw_report_errorFunction · 0.85

Tested by

no test coverage detected