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

Function PQgetCopyData

src/interfaces/libpq/fe-exec.c:2706–2720  ·  view source on GitHub ↗

* PQgetCopyData - read a row of data from the backend during COPY OUT * or COPY BOTH * * If successful, sets *buffer to point to a malloc'd row of data, and * returns row length (always > 0) as result. * Returns 0 if no row available yet (only possible if async is true), * -1 if end of copy (consult PQgetResult), or -2 if error (consult * PQerrorMessage). */

Source from the content-addressed store, hash-verified

2704 * PQerrorMessage).
2705 */
2706int
2707PQgetCopyData(PGconn *conn, char **buffer, int async)
2708{
2709 *buffer = NULL; /* for all failure cases */
2710 if (!conn)
2711 return -2;
2712 if (conn->asyncStatus != PGASYNC_COPY_OUT &&
2713 conn->asyncStatus != PGASYNC_COPY_BOTH)
2714 {
2715 appendPQExpBufferStr(&conn->errorMessage,
2716 libpq_gettext("no COPY in progress\n"));
2717 return -2;
2718 }
2719 return pqGetCopyData3(conn, buffer, async);
2720}
2721
2722/*
2723 * PQgetline - gets a newline-terminated string from the backend.

Callers 9

libpqrcv_receiveFunction · 0.85
cdbCopyGetDataFunction · 0.85
cdbCopyEndInternalFunction · 0.85
ecpg_process_outputFunction · 0.85
handleCopyOutFunction · 0.85
dumpTableData_copyFunction · 0.85
ReceiveCopyDataFunction · 0.85
StreamLogicalLogFunction · 0.85
CopyStreamReceiveFunction · 0.85

Calls 3

appendPQExpBufferStrFunction · 0.85
libpq_gettextFunction · 0.85
pqGetCopyData3Function · 0.85

Tested by

no test coverage detected