PQsetdbLogin
Description
Establishes a new connection with the database server.
Prototype
PGconn* PQsetdbLogin(const char* pghost, const char* pgport, const char* pgoptions, const char* pgtty,
const char* dbName, const char* login, const char* pwd); Parameters
| Keyword | Description |
|---|---|
| pghost | Name of the host to be connected. For details, see the host column described in Connection Parameters. |
| pgport | Port number of the host server. For details, see the port column described in Connection Parameters. |
| pgoptions | Command-line options to be sent to the server during running. For details, see the options column described in Connection Parameters. |
| pgtty | Ignored. (This option declares the output direction of server logs.) |
| dbName | Name of the database to be connected. For details, see the dbname column described in Connection Parameters. |
| login | Username for connection. For details, see the user column described in Connection Parameters. |
| pwd | Password used for authentication during connection. For details, see the password column described in Connection Parameters. |
Return Value
PGconn * points to the object pointer that contains a connection. The memory is allocated by the function internally.
Precautions
- This function is the predecessor of PQconnectdb with a fixed set of parameters. When an undefined parameter is called, its default value is used. The default value can be NULL or an empty string.
- If the dbName value contains an equal sign (=) or a valid prefix in the connection URL, it is taken as a conninfo string and passed to PQconnectdb, and the other parameters are consistent with those of PQconnectdbParams.