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

Function PQgetline

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

* PQgetline - gets a newline-terminated string from the backend. * * Chiefly here so that applications can use "COPY to stdout" * and read the output string. Returns a null-terminated string in s. * * XXX this routine is now deprecated, because it can't handle binary data. * If called during a COPY BINARY we return EOF. * * PQgetline reads up to maxlen-1 characters (like fgets(3)) b

Source from the content-addressed store, hash-verified

2743 * 1 in other cases (i.e., the buffer was filled before \n is reached)
2744 */
2745int
2746PQgetline(PGconn *conn, char *s, int maxlen)
2747{
2748 if (!s || maxlen <= 0)
2749 return EOF;
2750 *s = '\0';
2751 /* maxlen must be at least 3 to hold the \. terminator! */
2752 if (maxlen < 3)
2753 return EOF;
2754
2755 if (!conn)
2756 return EOF;
2757
2758 return pqGetline3(conn, s, maxlen);
2759}
2760
2761/*
2762 * PQgetlineAsync - gets a COPY data row without blocking.

Callers

nothing calls this directly

Calls 1

pqGetline3Function · 0.85

Tested by

no test coverage detected