Methods |
public
|
bindValue(string|int $param, mixed $value, mixed $type = ParameterType::STRING): bool
Binds a parameter value to the statement.
Binds a parameter value to the statement.
The value can optionally be bound with a PDO binding type or 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 |
The name or position of the parameter.
|
$value |
The value of the parameter.
|
$type |
Either a PDO binding type or a DBAL mapping type name or instance.
|
Returns
TRUE on success, FALSE on failure.
Implements
|
#
|
public
|
bindParam(string|int $param, mixed &$variable, int $type = ParameterType::STRING, int|null $length = null): bool
Binds a parameter to a value by reference.
Binds a parameter to a value by reference.
Binding a parameter by reference does not support DBAL mapping types.
Parameters
$param |
The name or position of the parameter.
|
$variable |
The reference to the variable to bind.
|
$type |
The PDO binding type.
|
$length |
Must be specified when using an OUT bind
so that PHP allocates enough memory to hold the returned value.
|
Returns
TRUE on success, FALSE on failure.
Implements
|
#
|
public
|
execute(mixed[]|null $params = null): bool
Executes the statement with the currently bound parameters.
Executes the statement with the currently bound parameters.
Deprecated
Statement::execute() is deprecated, use Statement::executeQuery() or executeStatement() instead
Parameters
$params |
An array of values with as many elements as there are
bound parameters in the SQL statement being executed.
|
Returns
TRUE on success, FALSE on failure.
Throws
Implements
|
#
|
public
|
executeQuery(mixed[] $params = []): Result
Executes the statement with the currently bound parameters and return result.
Executes the statement with the currently bound parameters and return result.
Throws
|
#
|
public
|
executeStatement(mixed[] $params = []): int
Executes the statement with the currently bound parameters and return affected rows.
Executes the statement with the currently bound parameters and return affected rows.
Throws
|
#
|
public
|
closeCursor(): bool
Closes the cursor, freeing the database resources used by this statement.
Closes the cursor, freeing the database resources used by this statement.
Deprecated
Use Result::free() instead.
Returns
TRUE on success, FALSE on failure.
Implements
|
#
|
public
|
columnCount(): int
Returns the number of columns in the result set.
Returns the number of columns in the result set.
Returns
The number of columns in the result set represented
by the PDOStatement object. If there is no result set,
this method should return 0.
Implements
|
#
|
public
|
errorCode(): string|int|bool
Fetches the SQLSTATE associated with the last operation on the statement.
Fetches the SQLSTATE associated with the last operation on the statement.
Deprecated
The error information is available via exceptions.
Returns
Implements
|
#
|
public
|
errorInfo()
{@inheritDoc}
Deprecated
The error information is available via exceptions.
Returns
Implements
|
#
|
public
|
setFetchMode($fetchMode, $arg2 = null, $arg3 = null)
{@inheritdoc}
Deprecated
Use one of the fetch- or iterate-related methods.
Parameters
$fetchMode |
The fetch mode must be one of the {@link FetchMode} constants.
|
Implements
|
#
|
public
|
getIterator()
Required by interface IteratorAggregate.
Required by interface IteratorAggregate.
Deprecated
Use iterateNumeric(), iterateAssociative() or iterateColumn() instead.
Implements
|
#
|
public
|
fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0)
{@inheritdoc}
Deprecated
Use fetchNumeric(), fetchAssociative() or fetchOne() instead.
Parameters
$fetchMode |
Controls how the next row will be returned to the caller.
The value must be one of the {@link FetchMode} constants,
defaulting to {@link FetchMode::MIXED}.
|
$cursorOrientation |
For a ResultStatement object representing a scrollable cursor,
this value determines which row will be returned to the caller.
This value must be one of the \PDO::FETCH_ORI_* constants,
defaulting to \PDO::FETCH_ORI_NEXT. To request a scrollable
cursor for your ResultStatement object, you must set the \PDO::ATTR_CURSOR
attribute to \PDO::CURSOR_SCROLL when you prepare the SQL statement with
\PDO::prepare().
|
$cursorOffset |
For a ResultStatement object representing a scrollable cursor for which the
cursorOrientation parameter is set to \PDO::FETCH_ORI_ABS, this value
specifies the absolute number of the row in the result set that shall be
fetched.
For a ResultStatement object representing a scrollable cursor for which the
cursorOrientation parameter is set to \PDO::FETCH_ORI_REL, this value
specifies the row to fetch relative to the cursor position before
ResultStatement::fetch() was called.
|
Returns
The return value of this method on success depends on the fetch mode. In all cases, FALSE is
returned on failure.
Implements
|
#
|
public
|
fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null)
{@inheritdoc}
Deprecated
Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead.
Parameters
$fetchMode |
Controls how the next row will be returned to the caller.
The value must be one of the {@link FetchMode} constants,
defaulting to {@link FetchMode::MIXED}.
|
$fetchArgument |
This argument has a different meaning depending on the value
of the $fetchMode parameter:
* {@link FetchMode::COLUMN}:
Returns the indicated 0-indexed column.
* {@link FetchMode::CUSTOM_OBJECT}:
Returns instances of the specified class, mapping the columns of each row
to named properties in the class.
* {@link PDO::FETCH_FUNC}: Returns the results of calling
the specified function, using each row's
columns as parameters in the call.
|
$ctorArgs |
Controls how the next row will be returned to the caller.
The value must be one of the {@link FetchMode} constants,
defaulting to {@link FetchMode::MIXED}.
|
Implements
|
#
|
public
|
fetchColumn($columnIndex = 0)
{@inheritDoc}
Deprecated
Parameters
$columnIndex |
0-indexed number of the column you wish to retrieve from the row.
If no value is supplied, fetches the first column.
|
Returns
A single column in the next row of a result set, or FALSE if there are no more rows.
Implements
|
#
|
public
|
fetchNumeric()
{@inheritdoc}
Deprecated
Use Result::fetchNumeric() instead
Throws
Implements
|
#
|
public
|
fetchAssociative()
{@inheritdoc}
Deprecated
Use Result::fetchAssociative() instead
Throws
Implements
|
#
|
public
|
fetchOne()
{@inheritDoc}
Deprecated
Use Result::fetchOne() instead
Throws
Implements
|
#
|
public
|
fetchAllNumeric(): array
{@inheritdoc}
Deprecated
Use Result::fetchAllNumeric() instead
Throws
Implements
|
#
|
public
|
fetchAllAssociative(): array
{@inheritdoc}
Deprecated
Use Result::fetchAllAssociative() instead
Throws
Implements
|
#
|
public
|
fetchAllKeyValue(): array<mixed, mixed>
Returns an associative array with the keys mapped to the first column and the values mapped to the second column.
Returns an associative array with the keys mapped to the first column and the values mapped to the second column.
The result must contain at least two columns.
Deprecated
Use Result::fetchAllKeyValue() instead
Throws
|
#
|
public
|
fetchAllAssociativeIndexed(): array<mixed, array<string, mixed>>
Returns an associative array with the keys mapped to the first column and the values being
an associative array…
Returns an associative array with the keys mapped to the first column and the values being
an associative array representing the rest of the columns and their values.
Deprecated
Use Result::fetchAllAssociativeIndexed() instead
Throws
|
#
|
public
|
fetchFirstColumn(): array
{@inheritdoc}
Deprecated
Use Result::fetchFirstColumn() instead
Throws
Implements
|
#
|
public
|
iterateNumeric(): Traversable<int, array<int, mixed>>
{@inheritDoc}
Deprecated
Use Result::iterateNumeric() instead
Throws
Implements
|
#
|
public
|
iterateAssociative(): Traversable<int, array<string, mixed>>
{@inheritDoc}
Deprecated
Use Result::iterateAssociative() instead
Throws
Implements
|
#
|
public
|
iterateKeyValue(): Traversable<mixed, mixed>
Returns an iterator over the result set with the keys mapped to the first column
and the values mapped to the second…
Returns an iterator over the result set with the keys mapped to the first column
and the values mapped to the second column.
The result must contain at least two columns.
Deprecated
Use Result::iterateKeyValue() instead
Throws
|
#
|
public
|
iterateAssociativeIndexed(): Traversable<mixed, array<string, mixed>>
Returns an iterator over the result set with the keys mapped to the first column and the values being
an associative…
Returns an iterator over the result set with the keys mapped to the first column and the values being
an associative array representing the rest of the columns and their values.
Deprecated
Use Result::iterateAssociativeIndexed() instead
Throws
|
#
|
public
|
iterateColumn(): Traversable<int, mixed>
{@inheritDoc}
Deprecated
Use Result::iterateColumn() instead
Throws
Implements
|
#
|
public
|
rowCount(): int|string
Returns the number of rows affected by the last execution of this statement.
Returns the number of rows affected by the last execution of this statement.
Returns
The number of affected rows.
Implements
|
#
|
public
|
free(): void
Discards the non-fetched portion of the result, enabling the originating statement to be executed again.
Discards the non-fetched portion of the result, enabling the originating statement to be executed again.
Implements
|
#
|
public
|
getWrappedStatement(): Statement
Gets the wrapped driver statement.
Gets the wrapped driver statement.
|
#
|