Packages » Package util » Class IterablePearDbResult

Class IterablePearDbResult

Declaration:
<? class IterablePearDbResult implements IterablePaginatedIterable ?>

Description:
This class is an Iterable wrapper around PEAR::DB_result. It allows to treat DB_result as a PaginatedIterable. This means that you can paginate it in a more comfort way.

Implemented Interfaces:
Iterable , PaginatedIterable

Methods:
  • __construct()
    Construct an IterablePearDbResult for DB_result
  • getCount()
    Get the total number of items in this iterable
  • getFirstRowNumber()
    Get the first row on current page
  • getLastRowNumber()
    Get the last row on current page, it may be less than getFirstRowNumber() + pageSize - 1 if the page selected is the last page and it contains less rows that pageSize.
  • getPage()
    Return current page
  • getPageSize()
    Return current page size
  • getPagesCount()
    Get total number of pages int the iterable
  • getRowsCount()
    Get total number of rows int the iterable
  • hasMore()
    Returns true if the result set has more records
  • next()
    Get the next record. Records are fetched with the DB_FETCHMODE_DEFAULT setting, so you can program it when you connect to the database
  • reset()
    Rewind this iterable to the before-the-first position. A call to the Iterable::getNext will fetch the first item. Note that in PaginatedIterable this method will rewind to the first item on the current page. Note: In order to avoid name collision method name has been changed. Previous name was "rewind"
  • setPage()
    Set current page
  • setPageSize()
    This should be the first method called. Normally PaginatedIterable implementations must call this method to initialize one-page pagination with page size set to number of rows in the iterator.