Function newPgClient


#include <orm_lib/inc/drogon/orm/DbClient.h>

static std::shared_ptr< DbClient > newPgClient(const std::string &connInfo, const size_t connNum)


Create a new database client with multiple connections;.


connInfo - Connection string with some parameters, each parameter setting is in the form keyword = value. Spaces around the equal sign are optional. To write an empty value, or a value containing spaces, surround it with single quotes, e.g., keyword = 'a value'. Single quotes and backslashes within the value must be escaped with a backslash, i.e., \' and \. Example: host=localhost port=5432 dbname=mydb connect_timeout=10 password='' The currently recognized parameter key words are:

  • host: can be either a host name or an IP address.
  • port: Port number to connect to at the server host.
  • dbname: The database name. Defaults to be the same as the user name.
  • user: user name to connect as. With PostgreSQL defaults to be the same as the operating system name of the user running the application.
  • password: Password to be used if the server demands password authentication.
  • client_encoding: The character set to be used on database connections.
For other key words on PostgreSQL, see the PostgreSQL documentation. Only a pair of key values ​​is valid for Sqlite3, and its keyword is 'filename'.

connNum - The number of connections to database server;

Mentioned in


Line 70 in orm_lib/inc/drogon/orm/DbClient.h.

Add Discussion as Guest

Log in to DocsForge