* 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
| 2743 | * 1 in other cases (i.e., the buffer was filled before \n is reached) |
| 2744 | */ |
| 2745 | int |
| 2746 | PQgetline(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. |
nothing calls this directly
no test coverage detected