Updated on 2024-05-07 GMT+08:00

PQconnectdbParams

Description

Establishes a new connection with the database server.

Prototype

1
PGconn* PQconnectdbParams(const char* const* keywords, const char* const* values, int expand_dbname);

Parameters

Table 1 PQconnectdbParams parameters

Keyword

Description

keywords

An array of strings, each of which is a keyword.

values

Value assigned to each keyword.

expand_dbname

When expand_dbname is non-zero, the dbname keyword value can be recognized as a connection string. Only dbname that first appears is expanded in this way, and any subsequent dbname value is treated as a database name.

Return Values

PGconn * points to the object pointer that contains a connection. The memory is allocated by the function internally.

Precautions

This function establishes a new database connection using the parameters taken from two NULL-terminated arrays. Unlike PQsetdbLogin, the parameter set can be extended without changing the function signature. Therefore, use of this function (or its non-blocking analogs PQconnectStartParams and PQconnectPoll) is preferred for new application programming.