PHP Class TeamTNT\TNTSearch\Connectors\MySqlConnector

Inheritance: extends Connector, implements TeamTNT\TNTSearch\Connectors\ConnectorInterface
Show file Open project: teamtnt/tntsearch

Public Methods

Method Description
connect ( array $config ) : PDO Establish a database connection.

Protected Methods

Method Description
configHasSocket ( array $config ) : boolean Determine if the given configuration array has a UNIX socket value.
getDsn ( array $config ) : string Create a DSN string from a configuration.
getHostDsn ( array $config ) : string Get the DSN string for a host / port configuration.
getSocketDsn ( array $config ) : string Get the DSN string for a socket configuration.
setModes ( PDO $connection, array $config ) : void Set the modes for the connection.

Method Details

configHasSocket() protected method

Determine if the given configuration array has a UNIX socket value.
protected configHasSocket ( array $config ) : boolean
$config array
return boolean

connect() public method

Establish a database connection.
public connect ( array $config ) : PDO
$config array
return PDO

getDsn() protected method

Chooses socket or host/port based on the 'unix_socket' config value.
protected getDsn ( array $config ) : string
$config array
return string

getHostDsn() protected method

Get the DSN string for a host / port configuration.
protected getHostDsn ( array $config ) : string
$config array
return string

getSocketDsn() protected method

Get the DSN string for a socket configuration.
protected getSocketDsn ( array $config ) : string
$config array
return string

setModes() protected method

Set the modes for the connection.
protected setModes ( PDO $connection, array $config ) : void
$connection PDO
$config array
return void