MySqlConnector
class MySqlConnector extends Connector implements ConnectorInterface (View source)
Traits
Properties
protected array | $options | The default PDO connection options. |
from Connector |
Methods
Determine if the given exception was caused by a lost connection.
Create a new PDO connection.
Create a new PDO connection instance.
Determine if the connection is persistent.
Handle an exception that occurred during connect execution.
Set the connection transaction isolation level.
Get the collation for the configuration.
Create a DSN string from a configuration.
Determine if the given configuration array has a UNIX socket value.
Get the DSN string for a socket configuration.
Get the DSN string for a host / port configuration.
Details
protected 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.
protected PDO
createPdoConnection(string $dsn, string $username, string $password, array $options)
Create a new PDO connection instance.
protected bool
isPersistentConnection(array $options)
Determine if the connection is persistent.
protected PDO
tryAgainIfCausedByLostConnection(Throwable $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.
protected void
configureIsolationLevel(PDO $connection, array $config)
Set the connection transaction isolation level.
protected void|PDO
configureEncoding(PDO $connection, array $config)
Set the connection character set and collation.
protected string
getCollation(array $config)
Get the collation for the configuration.
protected void
configureTimezone(PDO $connection, array $config)
Set the timezone on the connection.
protected string
getDsn(array $config)
Create a DSN string from a configuration.
Chooses socket or host/port based on the 'unix_socket' config value.
protected bool
hasSocket(array $config)
Determine if the given configuration array has a UNIX socket value.
protected string
getSocketDsn(array $config)
Get the DSN string for a socket configuration.
protected string
getHostDsn(array $config)
Get the DSN string for a host / port configuration.
protected void
setModes(PDO $connection, array $config)
Set the modes for the connection.
protected void
setCustomModes(PDO $connection, array $config)
Set the custom modes on the connection.
protected string
strictMode(PDO $connection, array $config)
Get the query to enable strict mode.