";
foreach($record as $k => $v) {
$result .= "" . Convert::raw2xml($v) . " | ";
}
$result .= "
\n";
$first = false;
}
if($first) return "No records found";
return $result;
}
/**
* Iterator function implementation. Rewind the iterator to the first item and return it.
* Makes use of {@link seek()} and {@link numRecords()}, takes care of the plumbing.
* @return array
*/
public function rewind() {
if($this->queryHasBegun && $this->numRecords() > 0) {
$this->queryHasBegun = false;
return $this->seek(0);
}
}
/**
* Iterator function implementation. Return the current item of the iterator.
* @return array
*/
public function current() {
if(!$this->currentRecord) {
return $this->next();
} else {
return $this->currentRecord;
}
}
/**
* Iterator function implementation. Return the first item of this iterator.
* @return array
*/
public function first() {
$this->rewind();
return $this->current();
}
/**
* Iterator function implementation. Return the row number of the current item.
* @return int
*/
public function key() {
return $this->rowNum;
}
/**
* Iterator function implementation. Return the next record in the iterator.
* Makes use of {@link nextRecord()}, takes care of the plumbing.
* @return array
*/
public function next() {
$this->queryHasBegun = true;
$this->currentRecord = $this->nextRecord();
$this->rowNum++;
return $this->currentRecord;
}
/**
* Iterator function implementation. Check if the iterator is pointing to a valid item.
* @return boolean
*/
public function valid() {
return $this->current() !== false;
}
/**
* Return the next record in the query result.
* @return array
*/
abstract function nextRecord();
/**
* Return the total number of items in the query result.
* @return int
*/
abstract function numRecords();
/**
* Go to a specific row number in the query result and return the record.
* @param int $rowNum Tow number to go to.
* @return array
*/
abstract function seek($rowNum);
}
?>