Updated on 2024-06-03 GMT+08:00

PQconnectStart

Description

Establishes a non-blocking connection with the database server.

Prototype

PGconn* PQconnectStart(const char* conninfo);

Parameter

Table 1

Keyword

Description

conninfo

String of connection information. This parameter can be left empty. In this case, the default value is used. It can contain one or more values separated by spaces or contain a URL.

Return Values

PGconn pointers
  • When the non-blocking mode (PQconnectStart+PQconnectPoll) is used to connect to the database and the connection information contains multiple IP addresses, libpq attempts to connect to each IP address in sequence and checks target_session_attrs until the connection is successful.
  • When the database is connected in non-blocking mode, the timeout detection needs to be processed by the upper-layer application.