Source for file IteratorAllGraphsDb.php

Documentation is available at IteratorAllGraphsDb.php

  1. <?php 
  2. //----------------------------------------------------------------------------------
  3. // Class: IteratorAllGraphsDb
  4. //----------------------------------------------------------------------------------
  5.  
  6.  
  7. /**
  8. * Implementation of a Graph iterator.
  9. *
  10. * This Iterator should be used in a for-loop like:
  11. * for($iterator = $dataset->listGraphs(); $iterator->valid(); $iterator->next())
  12. * {
  13. *    $currentResource=$iterator->current();
  14. * };
  15. *
  16. @version  $Id: fsource_dataset__datasetIteratorAllGraphsDb.php.html 442 2007-06-01 16:19:26Z cax $
  17. @author Daniel Westphal <mail at d-westphal dot de>
  18. *
  19. *
  20. @package     dataset
  21. @access    public
  22. ***/
  23. {
  24.     /**
  25.     * Holds a reference to the associated DB resultSet
  26.     * @var        $dbResultSets ADODB result
  27.     * @access    private
  28.     */
  29.     var $dbResultSet;
  30.     
  31.     /**
  32.     * Holds a reference to the associated datasetDb
  33.     * @var        datasetDb 
  34.     * @access    private
  35.     */
  36.     var $datasetDb;
  37.     
  38.     
  39.     /**
  40.     * The current position
  41.     * @var        integer 
  42.     * @access    private
  43.     */
  44.     var $key;
  45.     
  46.     
  47.     /**
  48.     * The current NamedGraph
  49.     * @var obejct NamedGraph
  50.     * @access    private
  51.     */
  52.     var $current;
  53.     
  54.     
  55.     
  56.     /**
  57.     * Constructor.
  58.     *
  59.     *
  60.     * @param ADODBResultSet 
  61.     * @param DatasetDb 
  62.     * @access    public
  63.     */
  64.     function IteratorAllGraphsDb(&$dbResultSet,&$datasetDb)
  65.     {
  66.         $this->dbResultSet=$dbResultSet;
  67.         $this->datasetDb=$datasetDb;
  68.         $this->current $this->dbResultSet->fields[0];
  69.     }
  70.     
  71.     /**
  72.     * Resets iterator list to start
  73.     *
  74.     * @access public
  75.     */
  76.     function rewind()
  77.     {
  78.         //not supported
  79.     }
  80.     
  81.     /**
  82.     * Says if there are additional items left in the list
  83.     *
  84.     * @return    boolean 
  85.     * @access    public
  86.     */
  87.     function valid()
  88.     {
  89.         return (!$this->dbResultSet->EOF);
  90.     }
  91.     
  92.     /**
  93.     * Moves Iterator to the next item in the list
  94.     *
  95.     * @access    public
  96.     */
  97.     function next()
  98.     {
  99.         $this->dbResultSet->moveNext();
  100.         $this->current $this->dbResultSet->fields[0];
  101.     }
  102.     
  103.     /**
  104.     * Returns the current item
  105.     *
  106.     * @return    mixed 
  107.     * @access    public
  108.     */
  109.     function &current()
  110.     {
  111.         return ($this->datasetDb->getNamedGraph($this->current));
  112.     }
  113.     
  114.     
  115.     /**
  116.     * Returns the key of the current item
  117.     *
  118.     * @return    integer 
  119.     * @access    public
  120.     */
  121.     function key()
  122.     {
  123.         return $this->dbResultSet->_currentRow;
  124.     }
  125. }
  126. ?>

Documentation generated on Fri, 1 Jun 2007 16:49:34 +0200 by phpDocumentor 1.3.2