internal package
Foswiki::Iterator::DBIterator internal package
Foswiki::Iterator::DBIterator is a
Foswiki::Iterator ClassMethod
new($dbh, $select, $values, $process) next()
below (optional)
DBIterator
may be used in its own but is mostly created as part of Foswiki::DBI::Database::eachRow()
.
Example use:
my $it = Foswiki::Iterator::DBIterator($dbh, "select * from ... where ..."); while ($it->hasNext) { my $row = $it->next(); my $firstName = $row->{firstName}; my $middleName = $row->{middleName}; my $lastName = $row->{lastName}; ... }
ObjectMethod
hasNext() → $boolean next()
.
ObjectMethod
next() → $row $row
return value is a hash reference as being created by DBI::fetchrow_hashref
ObjectMethod
reset() resets the iterator to restart the search to the beginning. note that the select statement (provided to the constructor) will be prepared and executed once again