class PostgresConnector extends Connector implements ConnectorInterface

Traits

Properties

protected array $options

The default PDO connection options.

Methods

bool
causedByLostConnection(Exception $e)

Determine if the given exception was caused by a lost connection.

PDO
createConnection(string $dsn, array $config, array $options)

Create a new PDO connection.

PDO
createPdoConnection(string $dsn, string $username, string $password, array $options)

Create a new PDO connection instance.

bool
isPersistentConnection(array $options)

Determine if the connection is persistent.

PDO
tryAgainIfCausedByLostConnection(Exception $e, string $dsn, string $username, string $password, array $options)

Handle an exception that occurred during connect execution.

array
getOptions(array $config)

Get the PDO options based on the configuration.

array
getDefaultOptions()

Get the default PDO connection options.

void
setDefaultOptions(array $options)

Set the default PDO connection options.

PDO
connect(array $config)

Establish a database connection.

void
configureEncoding(PDO $connection, array $config)

Set the connection character set and collation.

void
configureTimezone(PDO $connection, array $config)

Set the timezone on the connection.

void
configureSchema(PDO $connection, array $config)

Set the schema on the connection.

string
formatSchema(array|string $schema)

Format the schema for the DSN.

void
configureApplicationName(PDO $connection, array $config)

Set the schema on the connection.

string
getDsn(array $config)

Create a DSN string from a configuration.

string
addSslOptions(string $dsn, array $config)

Add the SSL options to the DSN.

Details

protected bool causedByLostConnection(Exception $e)

Determine if the given exception was caused by a lost connection.

Parameters

Exception $e

Return Value

bool

in Connector at line 36
PDO createConnection(string $dsn, array $config, array $options)

Create a new PDO connection.

Parameters

string $dsn
array $config
array $options

Return Value

PDO

in Connector at line 62
protected PDO createPdoConnection(string $dsn, string $username, string $password, array $options)

Create a new PDO connection instance.

Parameters

string $dsn
string $username
string $password
array $options

Return Value

PDO

in Connector at line 77
protected bool isPersistentConnection(array $options)

Determine if the connection is persistent.

Parameters

array $options

Return Value

bool

in Connector at line 95
protected PDO tryAgainIfCausedByLostConnection(Exception $e, string $dsn, string $username, string $password, array $options)

Handle an exception that occurred during connect execution.

Parameters

Exception $e
string $dsn
string $username
string $password
array $options

Return Value

PDO

Exceptions

Exception

in Connector at line 110
array getOptions(array $config)

Get the PDO options based on the configuration.

Parameters

array $config

Return Value

array

in Connector at line 122
array getDefaultOptions()

Get the default PDO connection options.

Return Value

array

in Connector at line 133
void setDefaultOptions(array $options)

Set the default PDO connection options.

Parameters

array $options

Return Value

void

at line 27
PDO connect(array $config)

Establish a database connection.

Parameters

array $config

Return Value

PDO

at line 60
protected void configureEncoding(PDO $connection, array $config)

Set the connection character set and collation.

Parameters

PDO $connection
array $config

Return Value

void

at line 74
protected void configureTimezone(PDO $connection, array $config)

Set the timezone on the connection.

Parameters

PDO $connection
array $config

Return Value

void

at line 90
protected void configureSchema(PDO $connection, array $config)

Set the schema on the connection.

Parameters

PDO $connection
array $config

Return Value

void

at line 105
protected string formatSchema(array|string $schema)

Format the schema for the DSN.

Parameters

array|string $schema

Return Value

string

at line 121
protected void configureApplicationName(PDO $connection, array $config)

Set the schema on the connection.

Parameters

PDO $connection
array $config

Return Value

void

at line 136
protected string getDsn(array $config)

Create a DSN string from a configuration.

Parameters

array $config

Return Value

string

at line 164
protected string addSslOptions(string $dsn, array $config)

Add the SSL options to the DSN.

Parameters

string $dsn
array $config

Return Value

string