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

Function PQconnectStart

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

* PQconnectStart * * Begins the establishment of a connection to a postgres backend through the * postmaster using connection information in a string. * * See comment for PQconnectdb for the definition of the string format. * * Returns a PGconn*. If NULL is returned, a malloc error has occurred, and * you should not attempt to proceed with this connection. If the status * field of the

Source from the content-addressed store, hash-verified

907 * See PQconnectPoll for more info.
908 */
909PGconn *
910PQconnectStart(const char *conninfo)
911{
912 PGconn *conn;
913
914 /*
915 * Allocate memory for the conn structure. Note that we also expect this
916 * to initialize conn->errorMessage to empty. All subsequent steps during
917 * connection initialization will only append to that buffer.
918 */
919 conn = makeEmptyPGconn();
920 if (conn == NULL)
921 return NULL;
922
923 /*
924 * Parse the conninfo string
925 */
926 if (!connectOptions1(conn, conninfo))
927 return conn;
928
929 /*
930 * Compute derived options
931 */
932 if (!connectOptions2(conn))
933 return conn;
934
935 /*
936 * Connect to the database
937 */
938 if (!connectDBStart(conn))
939 {
940 /* Just in case we failed to set it in connectDBStart */
941 conn->status = CONNECTION_BAD;
942 }
943
944 return conn;
945}
946
947/*
948 * Move option values into conn structure

Callers 4

ftsConnectStartFunction · 0.85
PQconnectdbFunction · 0.85
PQpingFunction · 0.85
ftsConnectStartFunction · 0.85

Calls 4

makeEmptyPGconnFunction · 0.85
connectOptions1Function · 0.85
connectOptions2Function · 0.85
connectDBStartFunction · 0.85

Tested by

no test coverage detected