Class \Prado\Data\TDbDataReader
TDbDataReader represents a forward-only stream of rows from a query result set.
To read the current row of data, call read. The method readAll returns all the rows in a single array.
One can also retrieve the rows of data in TDbDataReader by using foreach:
foreach($reader as $row)
// $row represents a row of data
Since TDbDataReader is a forward-only stream, you can only traverse it once.
It is possible to use a specific mode of data fetching by setting \Prado\Data\setFetchMode. See http://www.php.net/manual/en/function.PDOStatement-setFetchMode.php for more details.
Class hierarchy
- \Prado\Data\TDbDataReader implements Iterator
- \Prado\TComponent
Since: 3.0
public
|
|
public
|
bindColumn(mixed $column, mixed &$value[, null|int $dataType = null ]) : mixed
Binds a column to a PHP variable.
When rows of data are being fetched, the corresponding column value will be set in the variable. Note, the fetch mode must include PDO::FETCH_BOUND. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
key() : int
Returns the index of the current row.
This method is required by the interface Iterator. |
public
|
next() : void
Moves the internal pointer to the next row.
This method is required by the interface Iterator. |
public
|
nextResult() : mixed
Advances the reader to the next result when reading the results of a batch of statements.
This method is only useful when there are multiple result sets returned by the query. Not all DBMS support this feature. |
public
|
|
public
|
|
public
|
readColumn(int $columnIndex) : false|mixed
Returns a single column from the next row of a result set.
|
public
|
readObject(string $className, array<string|int, mixed> $fields) : false|mixed
Returns a single column from the next row of a result set.
|
public
|
rewind() : void
Resets the iterator to the initial state.
This method is required by the interface Iterator. |
public
|
|
public
|
valid() : bool
Returns whether there is a row of data at current position.
This method is required by the interface Iterator. |
\Prado\TComponent::GLOBAL_RAISE_EVENT_LISTENER |