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

Function PQconninfoParse

src/interfaces/libpq/fe-connect.c:5578–5595  ·  view source on GitHub ↗

* PQconninfoParse * * Parse a string like PQconnectdb() would do and return the * resulting connection options array. NULL is returned on failure. * The result contains only options specified directly in the string, * not any possible default values. * * If errmsg isn't NULL, *errmsg is set to NULL on success, or a malloc'd * string on failure (use PQfreemem to free it). In out-of-memor

Source from the content-addressed store, hash-verified

5576 * be freed when no longer needed via PQconninfoFree().
5577 */
5578PQconninfoOption *
5579PQconninfoParse(const char *conninfo, char **errmsg)
5580{
5581 PQExpBufferData errorBuf;
5582 PQconninfoOption *connOptions;
5583
5584 if (errmsg)
5585 *errmsg = NULL; /* default */
5586 initPQExpBuffer(&errorBuf);
5587 if (PQExpBufferDataBroken(errorBuf))
5588 return NULL; /* out of memory already :-( */
5589 connOptions = parse_connection_string(conninfo, &errorBuf, false);
5590 if (connOptions == NULL && errmsg)
5591 *errmsg = errorBuf.data;
5592 else
5593 termPQExpBuffer(&errorBuf);
5594 return connOptions;
5595}
5596
5597/*
5598 * Build a working copy of the constant PQconninfoOptions array.

Callers 7

dblink_connstr_checkFunction · 0.85
libpqrcv_check_conninfoFunction · 0.85
mainFunction · 0.85
do_connectFunction · 0.85
connectDatabaseFunction · 0.85
mainFunction · 0.85
GetConnectionFunction · 0.85

Calls 3

initPQExpBufferFunction · 0.85
parse_connection_stringFunction · 0.85
termPQExpBufferFunction · 0.85

Tested by 1

mainFunction · 0.68