Statement
in package
implements
Statement
Table of Contents
Interfaces
- Statement
- Driver-level statement
Constants
- LAST_INSERT_ID_SQL = ';SELECT SCOPE_IDENTITY() AS LastInsertId;'
- Append to any INSERT query to retrieve the last insert id.
Properties
- $conn : resource
- The SQLSRV Resource.
- $sql : string
- The SQL statement to execute.
- $stmt : resource|null
- The SQLSRV statement resource.
- $types : array<int, int>
- Bound parameter types.
- $variables : array<int, mixed>
- References to the variables bound as statement parameters.
Methods
- 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 {@see 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.
- execute() : Result
- Executes a prepared statement
- prepare() : resource
- Prepares SQL Server statement resource
Constants
LAST_INSERT_ID_SQL
Append to any INSERT query to retrieve the last insert id.
private
mixed
LAST_INSERT_ID_SQL
= ';SELECT SCOPE_IDENTITY() AS LastInsertId;'
Properties
$conn
The SQLSRV Resource.
private
resource
$conn
$sql
The SQL statement to execute.
private
string
$sql
$stmt
The SQLSRV statement resource.
private
resource|null
$stmt
$types
Bound parameter types.
private
array<int, int>
$types
= []
$variables
References to the variables bound as statement parameters.
private
array<int, mixed>
$variables
= []
Methods
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 {@see bindValue()}, the variable is bound as a reference and will only be evaluated at the time that PDOStatement->execute() is called.
public
bindParam(mixed $param, mixed &$variable[, mixed $type = ParameterType::STRING ][, mixed $length = 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.
- $variable : mixed
-
Name of the PHP variable to bind to the SQL statement parameter.
- $type : mixed = ParameterType::STRING
-
Explicit data type for the parameter using the ParameterType constants.
- $length : mixed = null
-
You must specify maxlength when using an OUT bind so that PHP allocates enough memory to hold the returned value.
Tags
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 = ParameterType::STRING ]) : 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 = ParameterType::STRING
-
Explicit data type for the parameter using the ParameterType constants.
Return values
bool —TRUE on success or FALSE on failure.
execute()
Executes a prepared statement
public
execute([mixed $params = null ]) : Result
Parameters
- $params : mixed = null
-
A numeric array of values with as many elements as there are bound parameters in the SQL statement being executed.
Return values
Resultprepare()
Prepares SQL Server statement resource
private
prepare() : resource