Statement
in package
A database abstraction-level statement that implements support for logging, DBAL mapping types, etc.
Table of Contents
Properties
- $conn : Connection
- The connection this statement is bound to and executed on.
- $params : array<string|int, mixed>
- The bound parameters.
- $platform : AbstractPlatform
- The underlying database platform.
- $sql : string
- The SQL statement.
- $stmt : Statement
- The underlying driver statement.
- $types : array<string|int, int>|array<string|int, string>
- The parameter types.
Methods
- bindParam() : bool
- Binds a parameter to a value by reference.
- bindValue() : bool
- Binds a parameter value to the statement.
- execute() : Result
- Executes the statement with the currently bound parameters.
- executeQuery() : Result
- Executes the statement with the currently bound parameters and return result.
- executeStatement() : int
- Executes the statement with the currently bound parameters and return affected rows.
- getWrappedStatement() : Statement
- Gets the wrapped driver statement.
Properties
$conn
The connection this statement is bound to and executed on.
protected
Connection
$conn
$params
The bound parameters.
protected
array<string|int, mixed>
$params
= []
$platform
The underlying database platform.
protected
AbstractPlatform
$platform
$sql
The SQL statement.
protected
string
$sql
$stmt
The underlying driver statement.
protected
Statement
$stmt
$types
The parameter types.
protected
array<string|int, int>|array<string|int, string>
$types
= []
Methods
bindParam()
Binds a parameter to a value by reference.
public
bindParam(string|int $param, mixed &$variable[, int $type = ParameterType::STRING ][, int|null $length = null ]) : bool
Binding a parameter by reference does not support DBAL mapping types.
Parameters
- $param : string|int
-
The name or position of the parameter.
- $variable : mixed
-
The reference to the variable to bind.
- $type : int = ParameterType::STRING
-
The binding type.
- $length : int|null = null
-
Must be specified when using an OUT bind so that PHP allocates enough memory to hold the returned value.
Tags
Return values
bool —TRUE on success, FALSE on failure.
bindValue()
Binds a parameter value to the statement.
public
bindValue(string|int $param, mixed $value[, mixed $type = ParameterType::STRING ]) : bool
The value can optionally be bound with a DBAL mapping type. If bound with a DBAL mapping type, the binding type is derived from the mapping type and the value undergoes the conversion routines of the mapping type before being bound.
Parameters
- $param : string|int
-
The name or position of the parameter.
- $value : mixed
-
The value of the parameter.
- $type : mixed = ParameterType::STRING
-
Either a PDO binding type or a DBAL mapping type name or instance.
Tags
Return values
bool —TRUE on success, FALSE on failure.
execute()
Executes the statement with the currently bound parameters.
public
execute([array<string|int, mixed>|null $params = null ]) : Result
Parameters
- $params : array<string|int, mixed>|null = null
Tags
Return values
ResultexecuteQuery()
Executes the statement with the currently bound parameters and return result.
public
executeQuery([array<string|int, mixed> $params = [] ]) : Result
Parameters
- $params : array<string|int, mixed> = []
Tags
Return values
ResultexecuteStatement()
Executes the statement with the currently bound parameters and return affected rows.
public
executeStatement([array<string|int, mixed> $params = [] ]) : int
Parameters
- $params : array<string|int, mixed> = []
Tags
Return values
intgetWrappedStatement()
Gets the wrapped driver statement.
public
getWrappedStatement() : Statement