[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/vendor/creole/ -> ResultSetIterator.php (sommaire)

(pas de description)

Poids: 113 lignes (3 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

ResultSetIterator:: (6 méthodes):
  __construct()
  rewind()
  valid()
  key()
  current()
  next()


Classe: ResultSetIterator  - X-Ref

Basic ResultSet Iterator.

This can be returned by your class's getIterator() method, but of course
you can also implement your own (e.g. to get better performance, by using direct
driver calls and avoiding other side-effects inherent in ResultSet scrolling
functions -- e.g. beforeFirst() / afterLast(), etc.).

Important: ResultSet iteration does rewind the resultset if it is not at the
start.  Not all drivers support reverse scrolling, so this may result in an
exception in some cases (Oracle).

Developer note:
The implementation of this class is a little weird because it fetches the
array _early_ in order to answer valid() w/o needing to know total num
of fields.  Remember the way iterators work:
<code>
$it = $obj->getIterator();
for($it->rewind(); $it->valid(); $it->next()) {
$key = $it->current();
$val = $it->key();
echo "$key = $val\n";
}
unset($it);
</code>

__construct(ResultSet $rs)   X-Ref
Construct the iterator.

param: ResultSet $rs

rewind()   X-Ref
If not at start of resultset, this method will call seek(0).


valid()   X-Ref
This method checks to see whether there are more results
by advancing the cursor position.


key()   X-Ref
Returns the cursor position.

return: int

current()   X-Ref
Returns the row (assoc array) at current cursor pos.

return: array

next()   X-Ref
This method does not actually do anything since we have already advanced
the cursor pos in valid().




Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7