class SQLSrvConnection implements Connection, ServerInfoAwareConnection (View source)

SQL Server implementation for the Connection interface.

Properties

protected resource $conn
protected LastInsertId $lastInsertId

Methods

__construct(string $serverName, mixed[] $connectionOptions)

No description

string
getServerVersion()

Returns the version number of the database server connected to.

bool
requiresQueryForServerVersion()

Checks whether a query is required to retrieve the database server version.

prepare(string $sql)

Prepares a statement for execution and returns a Statement object.

query(string $sql)

Executes an SQL statement, returning a result set as a Statement object.

mixed
quote($value, int $type = ParameterType::STRING)

Quotes a string for use in a query.

exec(string $statement)

Executes an SQL statement and return the number of affected rows.

string
lastInsertId(string|null $name = null)

Returns the ID of the last inserted row or sequence value.

bool
beginTransaction()

Initiates a transaction.

bool
commit()

Commits a transaction.

bool
rollBack()

Rolls back the current transaction, as initiated by beginTransaction().

string|null
errorCode()

Returns the error code associated with the last operation on the database handle.

mixed[]
errorInfo()

Returns extended error information associated with the last operation on the database handle.

Details

__construct(string $serverName, mixed[] $connectionOptions)

Parameters

string $serverName
mixed[] $connectionOptions

Exceptions

SQLSrvException

string getServerVersion()

Returns the version number of the database server connected to.

Return Value

string

bool requiresQueryForServerVersion()

Checks whether a query is required to retrieve the database server version.

Return Value

bool True if a query is required to retrieve the database server version, false otherwise.

prepare(string $sql)

Prepares a statement for execution and returns a Statement object.

Parameters

string $sql

query(string $sql)

Executes an SQL statement, returning a result set as a Statement object.

Parameters

string $sql

Exceptions

DBALException

mixed quote($value, int $type = ParameterType::STRING)

Quotes a string for use in a query.

Parameters

$value
int $type

Return Value

mixed

exec(string $statement)

Executes an SQL statement and return the number of affected rows.

Parameters

string $statement

Exceptions

DBALException

string lastInsertId(string|null $name = null)

Returns the ID of the last inserted row or sequence value.

Parameters

string|null $name

Return Value

string

bool beginTransaction()

Initiates a transaction.

Return Value

bool TRUE on success or FALSE on failure.

bool commit()

Commits a transaction.

Return Value

bool TRUE on success or FALSE on failure.

bool rollBack()

Rolls back the current transaction, as initiated by beginTransaction().

Return Value

bool TRUE on success or FALSE on failure.

string|null errorCode()

Returns the error code associated with the last operation on the database handle.

Return Value

string|null The error code, or null if no operation has been run on the database handle.

mixed[] errorInfo()

Returns extended error information associated with the last operation on the database handle.

Return Value

mixed[]