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

Function pqAllocCmdQueueEntry

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

* pqAllocCmdQueueEntry * Get a command queue entry for caller to fill. * * If the recycle queue has a free element, that is returned; if not, a * fresh one is allocated. Caller is responsible for adding it to the * command queue (pqAppendCmdQueueEntry) once the struct is filled in, or * releasing the memory (pqRecycleCmdQueueEntry) if an error occurs. * * If allocation fails, sets the er

Source from the content-addressed store, hash-verified

1244 * If allocation fails, sets the error message and returns NULL.
1245 */
1246PGcmdQueueEntry *
1247pqAllocCmdQueueEntry(PGconn *conn)
1248{
1249 PGcmdQueueEntry *entry;
1250
1251 if (conn->cmd_queue_recycle == NULL)
1252 {
1253 entry = (PGcmdQueueEntry *) malloc(sizeof(PGcmdQueueEntry));
1254 if (entry == NULL)
1255 {
1256 appendPQExpBufferStr(&conn->errorMessage,
1257 libpq_gettext("out of memory\n"));
1258 return NULL;
1259 }
1260 }
1261 else
1262 {
1263 entry = conn->cmd_queue_recycle;
1264 conn->cmd_queue_recycle = entry->next;
1265 }
1266 entry->next = NULL;
1267 entry->query = NULL;
1268
1269 return entry;
1270}
1271
1272/*
1273 * pqAppendCmdQueueEntry

Callers 6

PQsendGpQuery_sharedFunction · 0.85
PQsendQueryInternalFunction · 0.85
PQsendPrepareFunction · 0.85
PQsendQueryGutsFunction · 0.85
PQsendDescribeFunction · 0.85
PQpipelineSyncFunction · 0.85

Calls 2

appendPQExpBufferStrFunction · 0.85
libpq_gettextFunction · 0.85

Tested by

no test coverage detected