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

Function connectOptions1

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

* connectOptions1 * * Internal subroutine to set up connection parameters given an already- * created PGconn and a conninfo string. Derived settings should be * processed by calling connectOptions2 next. (We split them because * PQsetdbLogin overrides defaults in between.) * * Returns true if OK, false if trouble (in which case errorMessage is set * and so is conn->status). */

Source from the content-addressed store, hash-verified

995 * and so is conn->status).
996 */
997static bool
998connectOptions1(PGconn *conn, const char *conninfo)
999{
1000 PQconninfoOption *connOptions;
1001
1002 /*
1003 * Parse the conninfo string
1004 */
1005 connOptions = parse_connection_string(conninfo, &conn->errorMessage, true);
1006 if (connOptions == NULL)
1007 {
1008 conn->status = CONNECTION_BAD;
1009 /* errorMessage is already set */
1010 return false;
1011 }
1012
1013 /*
1014 * Move option values into conn structure
1015 */
1016 if (!fillPGconn(conn, connOptions))
1017 {
1018 conn->status = CONNECTION_BAD;
1019 PQconninfoFree(connOptions);
1020 return false;
1021 }
1022
1023 /*
1024 * Free the option info - all is in conn now
1025 */
1026 PQconninfoFree(connOptions);
1027
1028 return true;
1029}
1030
1031/*
1032 * Count the number of elements in a simple comma-separated list.

Callers 2

PQconnectStartFunction · 0.85
PQsetdbLoginFunction · 0.85

Calls 3

parse_connection_stringFunction · 0.85
fillPGconnFunction · 0.85
PQconninfoFreeFunction · 0.85

Tested by

no test coverage detected