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

Function PQexitPipelineMode

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

* PQexitPipelineMode * End pipeline mode and return to normal command mode. * * Returns 1 in success (pipeline mode successfully ended, or not in pipeline * mode). * * Returns 0 if in pipeline mode and cannot be ended yet. Error message will * be set. */

Source from the content-addressed store, hash-verified

2962 * be set.
2963 */
2964int
2965PQexitPipelineMode(PGconn *conn)
2966{
2967 if (!conn)
2968 return 0;
2969
2970 if (conn->pipelineStatus == PQ_PIPELINE_OFF)
2971 return 1;
2972
2973 switch (conn->asyncStatus)
2974 {
2975 case PGASYNC_READY:
2976 case PGASYNC_READY_MORE:
2977 /* there are some uncollected results */
2978 appendPQExpBufferStr(&conn->errorMessage,
2979 libpq_gettext("cannot exit pipeline mode with uncollected results\n"));
2980 return 0;
2981
2982 case PGASYNC_BUSY:
2983 appendPQExpBufferStr(&conn->errorMessage,
2984 libpq_gettext("cannot exit pipeline mode while busy\n"));
2985 return 0;
2986
2987 default:
2988 /* OK */
2989 break;
2990 }
2991
2992 /* still work to process */
2993 if (conn->cmd_queue_head != NULL)
2994 {
2995 appendPQExpBufferStr(&conn->errorMessage,
2996 libpq_gettext("cannot exit pipeline mode with uncollected results\n"));
2997 return 0;
2998 }
2999
3000 conn->pipelineStatus = PQ_PIPELINE_OFF;
3001 conn->asyncStatus = PGASYNC_IDLE;
3002
3003 /* Flush any pending data in out buffer */
3004 if (pqFlush(conn) < 0)
3005 return 0; /* error message is setup already */
3006 return 1;
3007}
3008
3009/*
3010 * pqCommandQueueAdvance

Callers 9

test_multi_pipelinesFunction · 0.85
test_pipeline_abortFunction · 0.85
test_pipelined_insertFunction · 0.85
test_preparedFunction · 0.85
test_simple_pipelineFunction · 0.85
test_singlerowmodeFunction · 0.85
test_transactionFunction · 0.85
readCommandResponseFunction · 0.85

Calls 3

appendPQExpBufferStrFunction · 0.85
libpq_gettextFunction · 0.85
pqFlushFunction · 0.85

Tested by 8

test_multi_pipelinesFunction · 0.68
test_pipeline_abortFunction · 0.68
test_pipelined_insertFunction · 0.68
test_preparedFunction · 0.68
test_simple_pipelineFunction · 0.68
test_singlerowmodeFunction · 0.68
test_transactionFunction · 0.68