class MariaDbConnector extends MySqlConnector

Traits

Properties

protected array $options

The default PDO connection options.

from  Connector

Methods

bool
causedByLostConnection(Throwable $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|null $username, string|null $password, array $options)

Create a new PDO connection instance.

PDO
tryAgainIfCausedByLostConnection(Throwable $e, string $dsn, string|null $username, string|null $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.

string
getDsn(array $config)

Create a DSN string from a configuration.

bool
hasSocket(array $config)

Determine if the given configuration array has a UNIX socket value.

string
getSocketDsn(array $config)

Get the DSN string for a socket configuration.

string
getHostDsn(array $config)

Get the DSN string for a host / port configuration.

void
configureConnection(PDO $connection, array $config)

Configure the given PDO connection.

string|null
getSqlMode(PDO $connection, array $config)

Get the sql_mode value.

Details

protected bool causedByLostConnection(Throwable $e)

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

Parameters

Throwable $e

Return Value

bool

in Connector at line 33
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

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

Create a new PDO connection instance.

Parameters

string $dsn
string|null $username
string|null $password
array $options

Return Value

PDO

in Connector at line 72
protected PDO tryAgainIfCausedByLostConnection(Throwable $e, string $dsn, string|null $username, string|null $password, array $options)

Handle an exception that occurred during connect execution.

Parameters

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

Return Value

PDO

Exceptions

Throwable

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

Get the PDO options based on the configuration.

Parameters

array $config

Return Value

array

in Connector at line 94
array getDefaultOptions()

Get the default PDO connection options.

Return Value

array

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

Set the default PDO connection options.

Parameters

array $options

Return Value

void

in MySqlConnector at line 14
PDO connect(array $config)

Establish a database connection.

Parameters

array $config

Return Value

PDO

in MySqlConnector at line 41
protected string getDsn(array $config)

Create a DSN string from a configuration.

Chooses socket or host/port based on the 'unix_socket' config value.

Parameters

array $config

Return Value

string

in MySqlConnector at line 51
protected bool hasSocket(array $config)

Determine if the given configuration array has a UNIX socket value.

Parameters

array $config

Return Value

bool

in MySqlConnector at line 59
protected string getSocketDsn(array $config)

Get the DSN string for a socket configuration.

Parameters

array $config

Return Value

string

in MySqlConnector at line 67
protected string getHostDsn(array $config)

Get the DSN string for a host / port configuration.

Parameters

array $config

Return Value

string

in MySqlConnector at line 77
protected void configureConnection(PDO $connection, array $config)

Configure the given PDO connection.

Parameters

PDO $connection
array $config

Return Value

void

at line 14
protected string|null getSqlMode(PDO $connection, array $config)

Get the sql_mode value.

Parameters

PDO $connection
array $config

Return Value

string|null