* getCopyResult * Helper for PQgetResult: generate result for COPY-in-progress cases */
| 2191 | * Helper for PQgetResult: generate result for COPY-in-progress cases |
| 2192 | */ |
| 2193 | static PGresult * |
| 2194 | getCopyResult(PGconn *conn, ExecStatusType copytype) |
| 2195 | { |
| 2196 | /* |
| 2197 | * If the server connection has been lost, don't pretend everything is |
| 2198 | * hunky-dory; instead return a PGRES_FATAL_ERROR result, and reset the |
| 2199 | * asyncStatus to idle (corresponding to what we'd do if we'd detected I/O |
| 2200 | * error in the earlier steps in PQgetResult). The text returned in the |
| 2201 | * result is whatever is in conn->errorMessage; we hope that was filled |
| 2202 | * with something relevant when the lost connection was detected. |
| 2203 | */ |
| 2204 | if (conn->status != CONNECTION_OK) |
| 2205 | { |
| 2206 | pqSaveErrorResult(conn); |
| 2207 | conn->asyncStatus = PGASYNC_IDLE; |
| 2208 | return pqPrepareAsyncResult(conn); |
| 2209 | } |
| 2210 | |
| 2211 | /* If we have an async result for the COPY, return that */ |
| 2212 | if (conn->result && conn->result->resultStatus == copytype) |
| 2213 | return pqPrepareAsyncResult(conn); |
| 2214 | |
| 2215 | /* Otherwise, invent a suitable PGresult */ |
| 2216 | return PQmakeEmptyPGresult(conn, copytype); |
| 2217 | } |
| 2218 | |
| 2219 | |
| 2220 | /* |
no test coverage detected