Result
class Result implements IDataSource
dibi result set.
$result = dibi::query('SELECT * FROM [table]');
$row = $result->fetch();
$value = $result->fetchSingle();
$table = $result->fetchAll();
$pairs = $result->fetchPairs();
$assoc = $result->fetchAssoc('col1');
$assoc = $result->fetchAssoc('col1[]col2->col3');
unset($result);
Properties
int read-only | $rowCount |
Methods
No description
Frees the resources allocated for this result set.
Safe access to property $driver.
Moves cursor position without fetching row.
Required by the Countable interface.
Returns the number of rows in a result set.
Required by the IteratorAggregate interface.
Set fetched object class. This class should extend the Row class.
Returns fetched object class name.
Set a factory to create fetched object instances. These should extend the Row class.
Like fetch(), but returns only first field.
Fetches all records from table and returns associative tree.
Fetches all records from table like $key => $value pairs.
Returns column type.
Returns data format.
No description
Displays complete result set as HTML or text table for debug purposes.
Details
at line 58
__construct($driver)
No description
at line 68
final
getResource()
deprecated
deprecated
No description
at line 79
final void
free()
Frees the resources allocated for this result set.
at line 93
final ResultDriver
getResultDriver()
Safe access to property $driver.
at line 112
final bool
seek($row)
Moves cursor position without fetching row.
at line 124
final int
count()
Required by the Countable interface.
at line 134
final int
getRowCount()
Returns the number of rows in a result set.
at line 144
final ResultIterator
getIterator()
Required by the IteratorAggregate interface.
at line 158
Result
setRowClass($class)
Set fetched object class. This class should extend the Row class.
at line 169
string
getRowClass()
Returns fetched object class name.
at line 179
Result
setRowFactory(callable $callback)
Set a factory to create fetched object instances. These should extend the Row class.
at line 191
final Row|false
fetch()
Fetches the row at current position, process optional type conversion.
and moves the internal cursor to the next position
at line 212
final mixed
fetchSingle()
Like fetch(), but returns only first field.
at line 230
final Row[]
fetchAll($offset = null, $limit = null)
Fetches all records from table.
at line 263
final array
fetchAssoc($assoc)
Fetches all records from table and returns associative tree.
Examples:
- associative descriptor: col1[]col2->col3 builds a tree: $tree[$val1][$index][$val2]->col3[$val3] = {record}
- associative descriptor: col1|col2->col3=col4 builds a tree: $tree[$val1][$val2]->col3[$val3] = val4
at line 410
final array
fetchPairs($key = null, $value = null)
Fetches all records from table like $key => $value pairs.
at line 543
final Result
setType($col, $type)
Define column type.
at line 554
final string
getType($col)
Returns column type.
at line 566
final Result
setFormat($type, $format)
Sets date format.
at line 577
final string|null
getFormat($type)
Returns data format.
at line 590
Result
getInfo()
Returns a meta information about the current result set.
at line 602
final Column[]
getColumns()
No description
at line 615
final void
dump()
Displays complete result set as HTML or text table for debug purposes.
Traits
Better OOP experience.