|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opengts.dbtools.DBRecordIterator<DBR>
public class DBRecordIterator<DBR extends DBRecord>
DBRecordIterator
is used to iterate through a DBRecord selection.
This DBRecordIterator currently uses the SQL DB provider OFFSET/LIMIT keywords to
iterate through a selection, and thus is only supported by DB providers that support
these keywords. This method has the disadvantage that record insertions/deletions
occurring while this DBRecordIterator is in use may cause this iterator to possibly
miss some records, or produce duplicate records.
Field Summary | |
---|---|
static long |
DEFAULT_LIMIT
|
Constructor Summary | |
---|---|
DBRecordIterator(DBR[] records)
Constructor |
|
DBRecordIterator(DBSelect<DBR> dbSel)
Constructor |
|
DBRecordIterator(java.lang.Iterable<DBR> iterable)
Constructor |
|
DBRecordIterator(java.util.Iterator<DBR> iterator)
Constructor |
Method Summary | |
---|---|
protected java.util.Iterator<DBR> |
fetch()
Preloads the next block of records to return. |
protected DBSelect<DBR> |
getDBSelect()
|
long |
getLimit()
Gets the block size limit |
boolean |
hasNext()
Returns true if another DBRecord is available from the iterator |
DBR |
next()
Returns the next object from the iterator |
void |
setLimit(long limit)
Sets the limit block size |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_LIMIT
Constructor Detail |
---|
public DBRecordIterator(DBR[] records)
records
- An array of DBRecordpublic DBRecordIterator(java.lang.Iterable<DBR> iterable)
iterable
- An Iterablepublic DBRecordIterator(java.util.Iterator<DBR> iterator)
iterator
- An iteratorpublic DBRecordIterator(DBSelect<DBR> dbSel) throws DBException
dbSel
- The DBSelect instance
DBException
- if the DBProvider does not support offset/limit.Method Detail |
---|
public long getLimit()
public void setLimit(long limit)
limit
- The block size limitpublic boolean hasNext() throws DBException
DBException
- if a DB access error occurs.public DBR next() throws DBException, DBNotFoundException
DBException
- if a DB access error occurs.
DBNotFoundException
- if there ore no more DBRecords to returnprotected DBSelect<DBR> getDBSelect()
protected java.util.Iterator<DBR> fetch() throws DBException, DBNotFoundException
DBException
DBNotFoundException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |