DataSetIterator Class Reference

The Iterator returned by DataSet::getIterator() that loops through the records. More...

List of all members.

Public Member Functions

 __construct (DataSet $ds)
 rewind ()
 valid ()
 key ()
 current ()
 next ()

Private Attributes

 $ds
 $size
 $pos


Detailed Description

The Iterator returned by DataSet::getIterator() that loops through the records.

Thanks to PHP5 SPL this allows you to foreach() over a DataSet: $ds = new QueryDataSet($conn, "select * from author"); $ds->fetchRecords(); foreach($ds as $rec) { print $rec->getValue("mycol"); }

See also:
DataSet::getIterator()

Definition at line 434 of file DataSet.php.


Constructor & Destructor Documentation

DataSetIterator::__construct ( DataSet ds  ) 

Definition at line 440 of file DataSet.php.

References DataSet::size().

00440                                       {
00441         $this->ds = $ds;
00442         $this->size = $ds->size();
00443     }


Member Function Documentation

DataSetIterator::current (  ) 

Definition at line 457 of file DataSet.php.

00457                        {
00458         return $this->ds->getRecord($this->pos);
00459     }

DataSetIterator::key (  ) 

Definition at line 453 of file DataSet.php.

00453                    {
00454         return $this->pos;
00455     }

DataSetIterator::next (  ) 

Definition at line 461 of file DataSet.php.

00461                     {
00462         $this->pos++;
00463     }

DataSetIterator::rewind (  ) 

Definition at line 445 of file DataSet.php.

00445                       {
00446         $this->pos = 0;
00447     }

DataSetIterator::valid (  ) 

Definition at line 449 of file DataSet.php.

00449                      {
00450         return $this->pos < $this->size;
00451     }


Member Data Documentation

DataSetIterator::$ds [private]

Definition at line 436 of file DataSet.php.

DataSetIterator::$pos [private]

Definition at line 438 of file DataSet.php.

DataSetIterator::$size [private]

Definition at line 437 of file DataSet.php.


The documentation for this class was generated from the following file:

Generated on Wed May 6 23:10:49 2009 for fareofficelib by  doxygen 1.5.8