PHP Class 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);
Inheritance: implements IDataSource, use trait dibi\Strict
Afficher le fichier Open project: dg/dibi Class Usage Examples

Méthodes publiques

Méthode Description
__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.

Private Methods

Méthode Description
detectTypes ( ) : void Autodetect column types.
normalize ( array &$row ) : void Converts values to specified type and format.
oldFetchAssoc ( $assoc )

Method Details

__construct() public méthode

public __construct ( $driver )

count() final public méthode

Required by the Countable interface.
final public count ( ) : integer
Résultat integer

dump() final public méthode

Displays complete result set as HTML or text table for debug purposes.
final public dump ( ) : void
Résultat void

fetch() final public méthode

and moves the internal cursor to the next position
final public fetch ( ) : Row | FALSE
Résultat Row | FALSE array on success, FALSE if no next record

fetchAll() final public méthode

Fetches all records from table.
final public fetchAll ( $offset = NULL, $limit = NULL ) : Row[]
Résultat Row[]

fetchAssoc() final public méthode

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
Résultat array

fetchPairs() final public méthode

Fetches all records from table like $key => $value pairs.
final public fetchPairs ( $key = NULL, $value = NULL ) : array
Résultat array

fetchSingle() final public méthode

Like fetch(), but returns only first field.
final public fetchSingle ( ) : mixed
Résultat mixed value on success, FALSE if no next record

free() final public méthode

Frees the resources allocated for this result set.
final public free ( ) : void
Résultat void

getColumns() final public méthode

final public getColumns ( ) : Dibi\Reflection\Column[]
Résultat Dibi\Reflection\Column[]

getFormat() final public méthode

Returns data format.
final public getFormat ( $type ) : string
Résultat string

getInfo() public méthode

Returns a meta information about the current result set.
public getInfo ( ) : Dibi\Reflection\Result
Résultat Dibi\Reflection\Result

getIterator() final public méthode

Required by the IteratorAggregate interface.
final public getIterator ( ) : dibi\ResultIterator
Résultat dibi\ResultIterator

getResource() final public méthode

Deprecation:
final public getResource ( )

getResultDriver() final public méthode

Safe access to property $driver.
final public getResultDriver ( ) : dibi\ResultDriver
Résultat dibi\ResultDriver

getRowClass() public méthode

Returns fetched object class name.
public getRowClass ( ) : string
Résultat string

getRowCount() final public méthode

Returns the number of rows in a result set.
final public getRowCount ( ) : integer
Résultat integer

getType() final public méthode

Returns column type.
final public getType ( $col ) : string
Résultat string

seek() final public méthode

Moves cursor position without fetching row.
final public seek ( $row ) : boolean
Résultat boolean TRUE on success, FALSE if unable to seek to specified record

setFormat() final public méthode

Sets data format.
final public setFormat ( $type, $format ) : self
Résultat self

setRowClass() public méthode

Set fetched object class. This class should extend the Row class.
public setRowClass ( $class ) : self
Résultat self

setRowFactory() public méthode

Set a factory to create fetched object instances. These should extend the Row class.
public setRowFactory ( callable $callback ) : self
$callback callable
Résultat self

setType() final public méthode

Define column type.
final public setType ( $col, $type ) : self
Résultat self