* This subroutine prepares an async result object for return to the caller. * If there is not already an async result object, build an error object * using whatever is in conn->errorMessage. In any case, clear the async * result storage. */
| 836 | * result storage. |
| 837 | */ |
| 838 | PGresult * |
| 839 | pqPrepareAsyncResult(PGconn *conn) |
| 840 | { |
| 841 | PGresult *res; |
| 842 | |
| 843 | /* |
| 844 | * conn->result is the PGresult to return. If it is NULL (which probably |
| 845 | * shouldn't happen) we assume there is an appropriate error message in |
| 846 | * conn->errorMessage. |
| 847 | */ |
| 848 | res = conn->result; |
| 849 | if (!res) |
| 850 | res = PQmakeEmptyPGresult(conn, PGRES_FATAL_ERROR); |
| 851 | |
| 852 | /* |
| 853 | * Replace conn->result with next_result, if any. In the normal case |
| 854 | * there isn't a next result and we're just dropping ownership of the |
| 855 | * current result. In single-row mode this restores the situation to what |
| 856 | * it was before we created the current single-row result. |
| 857 | */ |
| 858 | conn->result = conn->next_result; |
| 859 | conn->next_result = NULL; |
| 860 | |
| 861 | return res; |
| 862 | } |
| 863 | |
| 864 | /* |
| 865 | * pqInternalNotice - produce an internally-generated notice message |
no test coverage detected