class PostgreSQLAdapter extends AbstractConnection (View source)

Constants

PORT

Default PORT

Properties

protected ?string $name

The connexion nane

protected array $config

The configuration definition

from  AbstractConnection
protected int $fetch

The PDO fetch mode

from  AbstractConnection
protected PDO $write_pdo

The write (primary) PDO instance

from  AbstractConnection
protected PDO $read_pdo

The read (replica) PDO instance

from  AbstractConnection
protected array $write_config

The configuration used to build the write connection

from  AbstractConnection
protected ?array $read_config

The configuration used to build the read connection, or null when the connection is not split (reads use write).

from  AbstractConnection

Methods

__construct(array $config)

AbstractConnection constructor.

void
validateConfig(array $config)

Validate the connection configuration.

PDO
makePdo(array $config)

Build a PDO instance from the given configuration.

void
connection()

Build (eagerly) the write connection.

PDO
getConnection()

Retrieves the connection (the write/primary connection)

PDO
getWriteConnection()

Retrieves the write (primary) connection, building it lazily

PDO
getReadConnection()

Retrieves the read (replica) connection, building it lazily.

bool
hasWriteConnection()

Whether the write connection has already been established.

void
setConnection(PDO $pdo)

Set the connection (the write/primary connection)

string
getName()

Returns the name of the connection

void
setFetchMode(int $fetch)

Sets the data recovery mode.

array
getConfig()

Retrieves the configuration

string
getTablePrefix()

Retrieves the table prefix

string
getCharset()

Retrieves the type of encoding

string
getCollation()

Retrieves the define Collation

string
getPdoDriver()

Get the drive that PDO run on

bind(PDOStatement $pdo_statement, array $bindings = [])

Executes PDOStatement::bindValue on an instance of

Details

__construct(array $config)

AbstractConnection constructor.

Splits the connection configuration into a write (primary) configuration and an optional read (replica) configuration.

Parameters

array $config

protected void validateConfig(array $config)

Validate the connection configuration.

Parameters

array $config

Return Value

void

protected PDO makePdo(array $config)

Build a PDO instance from the given configuration.

Parameters

array $config

Return Value

PDO

void connection()

Build (eagerly) the write connection.

Kept for backward compatibility with callers that expect to (re)establish the connection explicitly.

Return Value

void

PDO getConnection()

Retrieves the connection (the write/primary connection)

Return Value

PDO

PDO getWriteConnection()

Retrieves the write (primary) connection, building it lazily

Return Value

PDO

PDO getReadConnection()

Retrieves the read (replica) connection, building it lazily.

Falls back to the write connection when the connection is not split.

Return Value

PDO

bool hasWriteConnection()

Whether the write connection has already been established.

Used to inspect transaction state without forcing a connection open.

Return Value

bool

void setConnection(PDO $pdo)

Set the connection (the write/primary connection)

Parameters

PDO $pdo

Return Value

void

string getName()

Returns the name of the connection

Return Value

string

void setFetchMode(int $fetch)

Sets the data recovery mode.

Parameters

int $fetch

Return Value

void

array getConfig()

Retrieves the configuration

Return Value

array

string getTablePrefix()

Retrieves the table prefix

Return Value

string

string getCharset()

Retrieves the type of encoding

Return Value

string

string getCollation()

Retrieves the define Collation

Return Value

string

string getPdoDriver()

Get the drive that PDO run on

Return Value

string

PDOStatement bind(PDOStatement $pdo_statement, array $bindings = [])

Executes PDOStatement::bindValue on an instance of

Parameters

PDOStatement $pdo_statement
array $bindings

Return Value

PDOStatement