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

Function pqSetResultError

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

* pqSetResultError - * assign a new error message to a PGresult */

Source from the content-addressed store, hash-verified

686 * assign a new error message to a PGresult
687 */
688void
689pqSetResultError(PGresult *res, PQExpBuffer errorMessage)
690{
691 char *msg;
692
693 if (!res)
694 return;
695
696 /*
697 * We handle two OOM scenarios here. The errorMessage buffer might be
698 * marked "broken" due to having previously failed to allocate enough
699 * memory for the message, or it might be fine but pqResultStrdup fails
700 * and returns NULL. In either case, just make res->errMsg point directly
701 * at a constant "out of memory" string.
702 */
703 if (!PQExpBufferBroken(errorMessage))
704 msg = pqResultStrdup(res, errorMessage->data);
705 else
706 msg = NULL;
707 if (msg)
708 res->errMsg = msg;
709 else
710 res->errMsg = libpq_gettext("out of memory\n");
711}
712
713/*
714 * PQclear -

Callers 2

PQmakeEmptyPGresultFunction · 0.85
PQgetResultFunction · 0.85

Calls 2

pqResultStrdupFunction · 0.85
libpq_gettextFunction · 0.85

Tested by

no test coverage detected