Class DibiResultIterator


External result set iterator.

This can be returned by DibiResult::getIterator() method or using foreach

  1. 1:  $result dibi::query('SELECT * FROM table');
  2. 2:  foreach ($result as $row{
  3. 3:     print_r($row);
  4. 4:  }
  5. 5:  unset($result);

Optionally you can specify offset and limit:

  1. 1:  foreach ($result->getIterator(23as $row{
  2. 2:      print_r($row);
  3. 3:  }


Implements interfaces:

Iterator (internal interface), Countable (internal interface)
Copyright: Copyright (c) 2005, 2010 David Grudl
Located: in /libs/DibiResultIterator.php (line 37)
Constructor Summary
public
__construct (DibiResult $result, [int $offset = NULL], [int $limit = NULL])
Method Summary
int
count ()
Required by the Countable interface.
mixed
current ()
Returns the current element.
mixed
key ()
Returns the key of the current element.
void
next ()
Moves forward to next element.
void
rewind ()
Rewinds the iterator to the first element.
bool
valid ()
Checks if there is a current element after calls to rewind() or next().

Constructor Details

line 60

__construct

public __construct (DibiResult $result, [int $offset = NULL], [int $limit = NULL])

Input
DibiResult $result
int $offset offset
int $limit limit
Method Details

line 132

count

public int count ()

Required by the Countable interface.

Implementation of:

Countable::count
Output
int  

line 97

current

public mixed current ()

Returns the current element.

Implementation of:

Iterator::current
Output
mixed  

line 86

key

public mixed key ()

Returns the key of the current element.

Implementation of:

Iterator::key
Output
mixed  

line 108

next

public void next ()

Moves forward to next element.

Implementation of:

Iterator::next
Output
void  

line 73

rewind

public void rewind ()

Rewinds the iterator to the first element.

Implementation of:

Iterator::rewind
Output
void  

line 121

valid

public bool valid ()

Checks if there is a current element after calls to rewind() or next().

Implementation of:

Iterator::valid
Output
bool