ArrayStatement
in package
implements
IteratorAggregate, ResultStatement
Interfaces, Classes and Traits
- IteratorAggregate
- ResultStatement
- Interface for the reading part of a prepare statement only.
Table of Contents
- $columnCount : int
- $data : array<string|int, mixed>
- $defaultFetchMode : int
- $num : int
- __construct() : mixed
- closeCursor() : bool
- Closes the cursor, enabling the statement to be executed again.
- columnCount() : int
- Returns the number of columns in the result set
- fetch() : mixed
- Returns the next row of a result set.
- fetchAll() : array<string|int, mixed>
- Returns an array containing all of the result set rows.
- fetchColumn() : string|bool
- Returns a single column from the next row of a result set or FALSE if there are no more rows.
- getIterator() : mixed
- {@inheritdoc}
- setFetchMode() : bool
- Sets the fetch mode to use while iterating this statement.
Properties
$columnCount
private
int
$columnCount
= 0
$data
private
array<string|int, mixed>
$data
$defaultFetchMode
private
int
$defaultFetchMode
= PDO::FETCH_BOTH
$num
private
int
$num
= 0
Methods
__construct()
public
__construct(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
Return values
mixed —closeCursor()
Closes the cursor, enabling the statement to be executed again.
public
closeCursor() : bool
Return values
bool —TRUE on success or FALSE on failure.
columnCount()
Returns the number of columns in the result set
public
columnCount() : int
Return values
int —The number of columns in the result set represented by the PDOStatement object. If there is no result set, this method should return 0.
fetch()
Returns the next row of a result set.
public
fetch([mixed $fetchMode = null ]) : mixed
Parameters
- $fetchMode : mixed = null
-
Controls how the next row will be returned to the caller. The value must be one of the PDO::FETCH_* constants, defaulting to PDO::FETCH_BOTH.
Return values
mixed —The return value of this method on success depends on the fetch mode. In all cases, FALSE is returned on failure.
fetchAll()
Returns an array containing all of the result set rows.
public
fetchAll([mixed $fetchMode = null ]) : array<string|int, mixed>
Parameters
- $fetchMode : mixed = null
-
Controls how the next row will be returned to the caller. The value must be one of the PDO::FETCH_* constants, defaulting to PDO::FETCH_BOTH.
Return values
array<string|int, mixed> —fetchColumn()
Returns a single column from the next row of a result set or FALSE if there are no more rows.
public
fetchColumn(mixed $columnIndex) : string|bool
Parameters
- $columnIndex : mixed
-
0-indexed number of the column you wish to retrieve from the row. If no value is supplied, PDOStatement->fetchColumn() fetches the first column.
Return values
string|bool —A single column in the next row of a result set, or FALSE if there are no more rows.
getIterator()
{@inheritdoc}
public
getIterator() : mixed
Return values
mixed —setFetchMode()
Sets the fetch mode to use while iterating this statement.
public
setFetchMode(mixed $fetchMode[, mixed $arg2 = null ][, mixed $arg3 = null ]) : bool
Parameters
- $fetchMode : mixed
-
The fetch mode must be one of the PDO::FETCH_* constants.
- $arg2 : mixed = null
- $arg3 : mixed = null