* pqPipelineProcessQueue: subroutine for PQgetResult * In pipeline mode, start processing the results of the next query in the queue. */
| 3033 | * In pipeline mode, start processing the results of the next query in the queue. |
| 3034 | */ |
| 3035 | static void |
| 3036 | pqPipelineProcessQueue(PGconn *conn) |
| 3037 | { |
| 3038 | switch (conn->asyncStatus) |
| 3039 | { |
| 3040 | case PGASYNC_COPY_IN: |
| 3041 | case PGASYNC_COPY_OUT: |
| 3042 | case PGASYNC_COPY_BOTH: |
| 3043 | case PGASYNC_READY: |
| 3044 | case PGASYNC_READY_MORE: |
| 3045 | case PGASYNC_BUSY: |
| 3046 | /* client still has to process current query or results */ |
| 3047 | return; |
| 3048 | case PGASYNC_IDLE: |
| 3049 | /* next query please */ |
| 3050 | break; |
| 3051 | } |
| 3052 | |
| 3053 | /* Nothing to do if not in pipeline mode, or queue is empty */ |
| 3054 | if (conn->pipelineStatus == PQ_PIPELINE_OFF || |
| 3055 | conn->cmd_queue_head == NULL) |
| 3056 | return; |
| 3057 | |
| 3058 | /* Initialize async result-accumulation state */ |
| 3059 | pqClearAsyncResult(conn); |
| 3060 | |
| 3061 | /* |
| 3062 | * Reset single-row processing mode. (Client has to set it up for each |
| 3063 | * query, if desired.) |
| 3064 | */ |
| 3065 | conn->singleRowMode = false; |
| 3066 | |
| 3067 | if (conn->pipelineStatus == PQ_PIPELINE_ABORTED && |
| 3068 | conn->cmd_queue_head->queryclass != PGQUERY_SYNC) |
| 3069 | { |
| 3070 | /* |
| 3071 | * In an aborted pipeline we don't get anything from the server for |
| 3072 | * each result; we're just discarding commands from the queue until we |
| 3073 | * get to the next sync from the server. |
| 3074 | * |
| 3075 | * The PGRES_PIPELINE_ABORTED results tell the client that its queries |
| 3076 | * got aborted. |
| 3077 | */ |
| 3078 | conn->result = PQmakeEmptyPGresult(conn, PGRES_PIPELINE_ABORTED); |
| 3079 | if (!conn->result) |
| 3080 | { |
| 3081 | appendPQExpBufferStr(&conn->errorMessage, |
| 3082 | libpq_gettext("out of memory\n")); |
| 3083 | pqSaveErrorResult(conn); |
| 3084 | return; |
| 3085 | } |
| 3086 | conn->asyncStatus = PGASYNC_READY; |
| 3087 | } |
| 3088 | else |
| 3089 | { |
| 3090 | /* allow parsing to continue */ |
| 3091 | conn->asyncStatus = PGASYNC_BUSY; |
| 3092 | } |
no test coverage detected