PHP Класс Dibi\Result

$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);
Наследование: implements IDataSource, use trait dibi\Strict
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( $driver )
count ( ) : integer Required by the Countable interface.
dump ( ) : void Displays complete result set as HTML or text table for debug purposes.
fetch ( ) : Row | FALSE Fetches the row at current position, process optional type conversion.
fetchAll ( $offset = NULL, $limit = NULL ) : Row[] Fetches all records from table.
fetchAssoc ( $assoc ) : array Fetches all records from table and returns associative tree.
fetchPairs ( $key = NULL, $value = NULL ) : array Fetches all records from table like $key => $value pairs.
fetchSingle ( ) : mixed Like fetch(), but returns only first field.
free ( ) : void Frees the resources allocated for this result set.
getColumns ( ) : Dibi\Reflection\Column[]
getFormat ( $type ) : string Returns data format.
getInfo ( ) : Dibi\Reflection\Result Returns a meta information about the current result set.
getIterator ( ) : dibi\ResultIterator Required by the IteratorAggregate interface.
getResource ( )
getResultDriver ( ) : dibi\ResultDriver Safe access to property $driver.
getRowClass ( ) : string Returns fetched object class name.
getRowCount ( ) : integer Returns the number of rows in a result set.
getType ( $col ) : string Returns column type.
seek ( $row ) : boolean Moves cursor position without fetching row.
setFormat ( $type, $format ) : self Sets data format.
setRowClass ( $class ) : self Set fetched object class. This class should extend the Row class.
setRowFactory ( callable $callback ) : self Set a factory to create fetched object instances. These should extend the Row class.
setType ( $col, $type ) : self Define column type.

Приватные методы

Метод Описание
detectTypes ( ) : void Autodetect column types.
normalize ( array &$row ) : void Converts values to specified type and format.
oldFetchAssoc ( $assoc )

Описание методов

__construct() публичный Метод

public __construct ( $driver )

count() закрытый публичный Метод

Required by the Countable interface.
final public count ( ) : integer
Результат integer

dump() закрытый публичный Метод

Displays complete result set as HTML or text table for debug purposes.
final public dump ( ) : void
Результат void

fetch() закрытый публичный Метод

and moves the internal cursor to the next position
final public fetch ( ) : Row | FALSE
Результат Row | FALSE array on success, FALSE if no next record

fetchAll() закрытый публичный Метод

Fetches all records from table.
final public fetchAll ( $offset = NULL, $limit = NULL ) : Row[]
Результат Row[]

fetchAssoc() закрытый публичный Метод

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
final public fetchAssoc ( $assoc ) : array
Результат array

fetchPairs() закрытый публичный Метод

Fetches all records from table like $key => $value pairs.
final public fetchPairs ( $key = NULL, $value = NULL ) : array
Результат array

fetchSingle() закрытый публичный Метод

Like fetch(), but returns only first field.
final public fetchSingle ( ) : mixed
Результат mixed value on success, FALSE if no next record

free() закрытый публичный Метод

Frees the resources allocated for this result set.
final public free ( ) : void
Результат void

getColumns() закрытый публичный Метод

final public getColumns ( ) : Dibi\Reflection\Column[]
Результат Dibi\Reflection\Column[]

getFormat() закрытый публичный Метод

Returns data format.
final public getFormat ( $type ) : string
Результат string

getInfo() публичный Метод

Returns a meta information about the current result set.
public getInfo ( ) : Dibi\Reflection\Result
Результат Dibi\Reflection\Result

getIterator() закрытый публичный Метод

Required by the IteratorAggregate interface.
final public getIterator ( ) : dibi\ResultIterator
Результат dibi\ResultIterator

getResource() закрытый публичный Метод

Устаревший:
final public getResource ( )

getResultDriver() закрытый публичный Метод

Safe access to property $driver.
final public getResultDriver ( ) : dibi\ResultDriver
Результат dibi\ResultDriver

getRowClass() публичный Метод

Returns fetched object class name.
public getRowClass ( ) : string
Результат string

getRowCount() закрытый публичный Метод

Returns the number of rows in a result set.
final public getRowCount ( ) : integer
Результат integer

getType() закрытый публичный Метод

Returns column type.
final public getType ( $col ) : string
Результат string

seek() закрытый публичный Метод

Moves cursor position without fetching row.
final public seek ( $row ) : boolean
Результат boolean TRUE on success, FALSE if unable to seek to specified record

setFormat() закрытый публичный Метод

Sets data format.
final public setFormat ( $type, $format ) : self
Результат self

setRowClass() публичный Метод

Set fetched object class. This class should extend the Row class.
public setRowClass ( $class ) : self
Результат self

setRowFactory() публичный Метод

Set a factory to create fetched object instances. These should extend the Row class.
public setRowFactory ( callable $callback ) : self
$callback callable
Результат self

setType() закрытый публичный Метод

Define column type.
final public setType ( $col, $type ) : self
Результат self