class SqlServerConnector extends Connector implements ConnectorInterface (View source)

Traits

Properties

protected array $options

The PDO connection options.

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 $username, string $password, array $options)

Create a new PDO connection instance.

bool
isPersistentConnection(array $options)

Determine if the connection is persistent.

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.

void
configureIsolationLevel(PDO $connection, array $config)

Set the connection transaction isolation level.

string
getDsn(array $config)

Create a DSN string from a configuration.

bool
prefersOdbc(array $config)

Determine if the database configuration prefers ODBC.

string
getDblibDsn(array $config)

Get the DSN string for a DbLib connection.

string
getOdbcDsn(array $config)

Get the DSN string for an ODBC connection.

string
getSqlSrvDsn(array $config)

Get the DSN string for a SqlSrv connection.

string
buildConnectString(string $driver, array $arguments)

Build a connection string from the given arguments.

string
buildHostString(array $config, string $separator)

Build a host string from the given configuration.

array
getAvailableDrivers()

Get the available PDO drivers.

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 configureIsolationLevel(PDO $connection, array $config)

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 bool prefersOdbc(array $config)

Determine if the database configuration prefers ODBC.

Parameters

array $config

Return Value

bool

protected string getDblibDsn(array $config)

Get the DSN string for a DbLib connection.

Parameters

array $config

Return Value

string

protected string getOdbcDsn(array $config)

Get the DSN string for an ODBC connection.

Parameters

array $config

Return Value

string

protected string getSqlSrvDsn(array $config)

Get the DSN string for a SqlSrv connection.

Parameters

array $config

Return Value

string

protected string buildConnectString(string $driver, array $arguments)

Build a connection string from the given arguments.

Parameters

string $driver
array $arguments

Return Value

string

protected string buildHostString(array $config, string $separator)

Build a host string from the given configuration.

Parameters

array $config
string $separator

Return Value

string

protected array getAvailableDrivers()

Get the available PDO drivers.

Return Value

array