PostgreSQLConnection constructor

PostgreSQLConnection(
  1. String host,
  2. int port,
  3. String databaseName, {
  4. String? username,
  5. String? password,
  6. int timeoutInSeconds = 30,
  7. int queryTimeoutInSeconds = 30,
  8. String timeZone = 'UTC',
  9. bool useSSL = false,
  10. bool isUnixSocket = false,
  11. bool allowClearTextPassword = false,
  12. ReplicationMode replicationMode = ReplicationMode.none,
  13. Encoding? encoding,
})

Creates an instance of PostgreSQLConnection.

host must be a hostname, e.g. "foobar.com" or IP address. Do not include scheme or port. port is the port to connect to the database on. It is typically 5432 for default PostgreSQL settings. databaseName is the name of the database to connect to. username and password are optional if the database requires user authentication. timeoutInSeconds refers to the amount of time PostgreSQLConnection will wait while establishing a connection before it gives up. queryTimeoutInSeconds refers to the default timeout for PostgreSQLExecutionContext's execute and query methods. timeZone is the timezone the connection is in. Defaults to 'UTC'. useSSL when true, uses a secure socket when connecting to a PostgreSQL database. allowClearTextPassword when true, allows sending the password during authentication in clear text. Use only when required by the database server and under encrypted connections, this feature may lead to security issues.

Implementation

PostgreSQLConnection(
  this.host,
  this.port,
  this.databaseName, {
  this.username,
  this.password,
  this.timeoutInSeconds = 30,
  this.queryTimeoutInSeconds = 30,
  this.timeZone = 'UTC',
  this.useSSL = false,
  this.isUnixSocket = false,
  this.allowClearTextPassword = false,
  this.replicationMode = ReplicationMode.none,
  Encoding? encoding,
}) : _encoding = encoding ?? utf8 {
  _connectionState = _PostgreSQLConnectionStateClosed();
  _connectionState.connection = this;
}