Packages

  • dibi
    • drivers
    • nette
    • reflection
  • None
  • PHP

Classes

  • dibi
  • DibiConnection
  • DibiDataSource
  • DibiDateTime
  • DibiEvent
  • DibiFileLogger
  • DibiFirePhpLogger
  • DibiFluent
  • DibiObject
  • DibiResult
  • DibiResultIterator
  • DibiRow
  • DibiTranslator

Interfaces

  • IDataSource
  • IDibiDriver
  • IDibiReflector
  • IDibiResultDriver

Exceptions

  • DibiDriverException
  • DibiException
  • DibiNotImplementedException
  • DibiNotSupportedException
  • DibiPcreException
  • Overview
  • Package
  • Class
  • Tree

Class DibiResult

dibi result set.

$result = dibi::query('SELECT * FROM [table]');

$row   = $result->fetch();
$value = $result->fetchSingle();
$table = $result->fetchAll();
$pairs = $result->fetchPairs();
$assoc = $result->fetchAssoc('id');
$assoc = $result->fetchAssoc('active,#,id');

unset($result);
DibiObject
Extended by DibiResult implements IDataSource
Package: dibi
Author: David Grudl
Located at libs/DibiResult.php
Methods summary
public
# __construct( IDibiResultDriver $driver, array $config )

Parameters

$driver
IDibiResultDriver
$config
array
final public mixed
# getResource( )

Returns the result set resource.

Returns the result set resource.

Returns

mixed
final public
# free( )

Frees the resources allocated for this result set.

Frees the resources allocated for this result set.

final public boolean
# seek( integer $row )

Moves cursor position without fetching row.

Moves cursor position without fetching row.

Parameters

$row
integer
the 0-based cursor pos to seek to

Returns

boolean
TRUE on success, FALSE if unable to seek to specified record

Throws

DibiException
final public integer
# count( )

Required by the Countable interface.

Required by the Countable interface.

Returns

integer

Implementation of

Countable::count
final public integer
# getRowCount( )

Returns the number of rows in a result set.

Returns the number of rows in a result set.

Returns

integer
final public DibiResultIterator
# getIterator( )

Required by the IteratorAggregate interface.

Required by the IteratorAggregate interface.

Returns

DibiResultIterator

Implementation of

IteratorAggregate::getIterator
public DibiResult
# setRowClass( string $class )

Set fetched object class. This class should extend the DibiRow class.

Set fetched object class. This class should extend the DibiRow class.

Parameters

$class
string

Returns

DibiResult
provides a fluent interface
public string
# getRowClass( )

Returns fetched object class name.

Returns fetched object class name.

Returns

string
final public DibiRow|false
# fetch( )

Fetches the row at current position, process optional type conversion. and moves the internal cursor to the next position

Fetches the row at current position, process optional type conversion. and moves the internal cursor to the next position

Returns

DibiRow|false
array on success, FALSE if no next record
final public mixed
# fetchSingle( )

Like fetch(), but returns only first field.

Like fetch(), but returns only first field.

Returns

mixed
value on success, FALSE if no next record
final public array
# fetchAll( integer $offset = NULL, integer $limit = NULL )

Fetches all records from table.

Fetches all records from table.

Parameters

$offset
integer
offset
$limit
integer
limit

Returns

array
of DibiRow
final public DibiRow
# fetchAssoc( string $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

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

Parameters

$assoc
string
associative descriptor

Returns

DibiRow

Throws

InvalidArgumentException
final public array
# fetchPairs( string $key = NULL, string $value = NULL )

Fetches all records from table like $key => $value pairs.

Fetches all records from table like $key => $value pairs.

Parameters

$key
string
associative key
$value
string
value

Returns

array

Throws

InvalidArgumentException
final public DibiResult
# setType( string $col, string $type )

Define column type.

Define column type.

Parameters

$col
string
column
$type
string
type (use constant Dibi::*)

Returns

DibiResult
provides a fluent interface
final public string
# getType( $col )

Returns column type.

Returns column type.

Returns

string
public DibiResultInfo
# getInfo( )

Returns a meta information about the current result set.

Returns a meta information about the current result set.

Returns

DibiResultInfo
final public
# dump( )

Displays complete result set as HTML table for debug purposes.

Displays complete result set as HTML table for debug purposes.

Methods inherited from DibiObject
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getClass(), getReflection()
dibi API documentation API documentation generated by ApiGen 2.3.0