PostgresConnector

class PostgresConnector extends Connector implements ConnectorInterface (View source)

Traits

DetectsLostConnections

Properties

protected array $options The default PDO connection options.

Methods

bool causedByLostConnection(Throwable $e)

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

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

Create a new PDO connection.

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

Create a new PDO connection instance.

from Connector
bool isPersistentConnection(array $options)

Determine if the connection is persistent.

from Connector
PDO tryAgainIfCausedByLostConnection(Throwable $e, string $dsn, string $username, string $password, array $options)

Handle an exception that occurred during connect execution.

from Connector
array getOptions(array $config)

Get the PDO options based on the configuration.

from Connector
array getDefaultOptions()

Get the default PDO connection options.

from Connector
void setDefaultOptions(array $options)

Set the default PDO connection options.

from Connector
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.

void configureSynchronousCommit(PDO $connection, array $config)

Configure the synchronous_commit setting.

Details

protected bool causedByLostConnection(Throwable $e)

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

Parameters

Throwable $e

Return Value

bool

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

Create a new PDO connection.

Parameters

string $dsn
array $config
array $options

Return Value

PDO

Exceptions

Exception

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

protected bool isPersistentConnection(array $options)

Determine if the connection is persistent.

Parameters

array $options

Return Value

bool

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

Handle an exception that occurred during connect execution.

Parameters

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

Return Value

PDO

Exceptions

Exception

array getOptions(array $config)

Get the PDO options based on the configuration.

Parameters

array $config

Return Value

array

array getDefaultOptions()

Get the default PDO connection options.

Return Value

array

void setDefaultOptions(array $options)

Set the default PDO connection options.

Parameters

array $options

Return Value

void

PDO connect(array $config)

Establish a database connection.

Parameters

array $config

Return Value

PDO

protected void configureEncoding(PDO $connection, array $config)

Set the connection character set and collation.

Parameters

PDO $connection
array $config

Return Value

void

protected void configureTimezone(PDO $connection, array $config)

Set the timezone on the connection.

Parameters

PDO $connection
array $config

Return Value

void

protected void configureSchema(PDO $connection, array $config)

Set the schema on the connection.

Parameters

PDO $connection
array $config

Return Value

void

protected string formatSchema(array|string $schema)

Format the schema for the DSN.

Parameters

array|string $schema

Return Value

string

protected void configureApplicationName(PDO $connection, array $config)

Set the schema on the connection.

Parameters

PDO $connection
array $config

Return Value

void

protected string getDsn(array $config)

Create a DSN string from a configuration.

Parameters

array $config

Return Value

string

protected string addSslOptions(string $dsn, array $config)

Add the SSL options to the DSN.

Parameters

string $dsn
array $config

Return Value

string

protected void configureSynchronousCommit(PDO $connection, array $config)

Configure the synchronous_commit setting.

Parameters

PDO $connection
array $config

Return Value

void

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Database/Connectors/PostgresConnector.html