SQLSrvStatement
in package
implements
IteratorAggregate, Statement
SQL Server Statement.
Tags
Interfaces, Classes and Traits
- IteratorAggregate
- Statement
- Statement interface.
Table of Contents
- LAST_INSERT_ID_SQL = ';SELECT SCOPE_IDENTITY() AS LastInsertId;'
- Append to any INSERT query to retrieve the last insert id.
- $conn : resource
- The SQLSRV Resource.
- $defaultFetchClass : string
- The name of the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
- $defaultFetchClassCtorArgs : string
- The constructor arguments for the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
- $defaultFetchMode : mixed
- The fetch style.
- $fetchMap : array<string|int, mixed>
- Translations.
- $lastInsertId : LastInsertId|null
- The last insert ID.
- $result : bool
- Indicates whether the statement is in the state when fetching results is possible
- $sql : string
- The SQL statement to execute.
- $stmt : resource
- The SQLSRV statement resource.
- $types : array<string|int, mixed>
- Bound parameter types.
- $variables : array<string|int, mixed>
- References to the variables bound as statement parameters.
- __construct() : mixed
- bindParam() : bool
- Binds a PHP variable to a corresponding named (not supported by mysqli driver, see comment below) or question mark placeholder in the SQL statement that was use to prepare the statement. Unlike PDOStatement->bindValue(), the variable is bound as a reference and will only be evaluated at the time that PDOStatement->execute() is called.
- bindValue() : bool
- Binds a value to a corresponding named (not supported by mysqli driver, see comment below) or positional placeholder in the SQL statement that was used to prepare the statement.
- closeCursor() : mixed
- {@inheritdoc}
- columnCount() : mixed
- {@inheritdoc}
- errorCode() : string
- Fetches the SQLSTATE associated with the last operation on the statement handle.
- errorInfo() : array<string|int, mixed>
- Fetches extended error information associated with the last operation on the statement handle.
- execute() : bool
- Executes a prepared statement
- fetch() : mixed
- {@inheritdoc}
- fetchAll() : mixed
- {@inheritdoc}
- fetchColumn() : mixed
- {@inheritdoc}
- getIterator() : mixed
- {@inheritdoc}
- rowCount() : int
- Returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement executed by the corresponding object.
- setFetchMode() : mixed
- {@inheritdoc}
- prepare() : resource
- Prepares SQL Server statement resource
Constants
LAST_INSERT_ID_SQL
Append to any INSERT query to retrieve the last insert id.
public
string
LAST_INSERT_ID_SQL
= ';SELECT SCOPE_IDENTITY() AS LastInsertId;'
Properties
$conn
The SQLSRV Resource.
private
resource
$conn
$defaultFetchClass
The name of the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
private
string
$defaultFetchClass
= '\stdClass'
$defaultFetchClassCtorArgs
The constructor arguments for the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
private
string
$defaultFetchClassCtorArgs
= array()
$defaultFetchMode
The fetch style.
private
mixed
$defaultFetchMode
= PDO::FETCH_BOTH
$fetchMap
Translations.
private
static array<string|int, mixed>
$fetchMap
= array(PDO::FETCH_BOTH => SQLSRV_FETCH_BOTH, PDO::FETCH_ASSOC => SQLSRV_FETCH_ASSOC, PDO::FETCH_NUM => SQLSRV_FETCH_NUMERIC)
$lastInsertId
The last insert ID.
private
LastInsertId|null
$lastInsertId
$result
Indicates whether the statement is in the state when fetching results is possible
private
bool
$result
= false
$sql
The SQL statement to execute.
private
string
$sql
$stmt
The SQLSRV statement resource.
private
resource
$stmt
$types
Bound parameter types.
private
array<string|int, mixed>
$types
= array()
$variables
References to the variables bound as statement parameters.
private
array<string|int, mixed>
$variables
= array()
Methods
__construct()
public
__construct(resource $conn, string $sql[, LastInsertId|null $lastInsertId = null ]) : mixed
Parameters
- $conn : resource
- $sql : string
- $lastInsertId : LastInsertId|null = null
Return values
mixed —bindParam()
Binds a PHP variable to a corresponding named (not supported by mysqli driver, see comment below) or question mark placeholder in the SQL statement that was use to prepare the statement. Unlike PDOStatement->bindValue(), the variable is bound as a reference and will only be evaluated at the time that PDOStatement->execute() is called.
public
bindParam(mixed $column, mixed &$variable[, mixed $type = null ][, mixed $length = null ]) : bool
Parameters
- $column : mixed
-
Parameter identifier. For a prepared statement using named placeholders, this will be a parameter name of the form :name. For a prepared statement using question mark placeholders, this will be the 1-indexed position of the parameter.
- $variable : mixed
-
Name of the PHP variable to bind to the SQL statement parameter.
- $type : mixed = null
-
Explicit data type for the parameter using the PDO::PARAM_* constants. To return an INOUT parameter from a stored procedure, use the bitwise OR operator to set the PDO::PARAM_INPUT_OUTPUT bits for the data_type parameter.
- $length : mixed = null
-
You must specify maxlength when using an OUT bind so that PHP allocates enough memory to hold the returned value.
Return values
bool —TRUE on success or FALSE on failure.
bindValue()
Binds a value to a corresponding named (not supported by mysqli driver, see comment below) or positional placeholder in the SQL statement that was used to prepare the statement.
public
bindValue(mixed $param, mixed $value[, mixed $type = null ]) : bool
Parameters
- $param : mixed
-
Parameter identifier. For a prepared statement using named placeholders, this will be a parameter name of the form :name. For a prepared statement using question mark placeholders, this will be the 1-indexed position of the parameter.
- $value : mixed
-
The value to bind to the parameter.
- $type : mixed = null
-
Explicit data type for the parameter using the PDO::PARAM_* constants.
Return values
bool —TRUE on success or FALSE on failure.
closeCursor()
{@inheritdoc}
public
closeCursor() : mixed
Return values
mixed —columnCount()
{@inheritdoc}
public
columnCount() : mixed
Return values
mixed —errorCode()
Fetches the SQLSTATE associated with the last operation on the statement handle.
public
errorCode() : string
Return values
string —The error code string.
errorInfo()
Fetches extended error information associated with the last operation on the statement handle.
public
errorInfo() : array<string|int, mixed>
Return values
array<string|int, mixed> —The error info array.
execute()
Executes a prepared statement
public
execute([mixed $params = null ]) : bool
Parameters
- $params : mixed = null
-
An array of values with as many elements as there are bound parameters in the SQL statement being executed.
Return values
bool —TRUE on success or FALSE on failure.
fetch()
{@inheritdoc}
public
fetch([mixed $fetchMode = null ]) : mixed
Parameters
- $fetchMode : mixed = null
Return values
mixed —fetchAll()
{@inheritdoc}
public
fetchAll([mixed $fetchMode = null ]) : mixed
Parameters
- $fetchMode : mixed = null
Return values
mixed —fetchColumn()
{@inheritdoc}
public
fetchColumn(mixed $columnIndex) : mixed
Parameters
- $columnIndex : mixed
Return values
mixed —getIterator()
{@inheritdoc}
public
getIterator() : mixed
Return values
mixed —rowCount()
Returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement executed by the corresponding object.
public
rowCount() : int
Return values
int —The number of rows.
setFetchMode()
{@inheritdoc}
public
setFetchMode(mixed $fetchMode[, mixed $arg2 = null ][, mixed $arg3 = null ]) : mixed
Parameters
- $fetchMode : mixed
- $arg2 : mixed = null
- $arg3 : mixed = null
Return values
mixed —prepare()
Prepares SQL Server statement resource
private
prepare() : resource