|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.DynamicResultIterator
public class DynamicResultIterator
An iterator view of the result of an AbstractSqlQuery
.
AbstractSqlQuery.iterate(DbControl)
Nested Class Summary | |
---|---|
private class |
DynamicResultIterator.SqlResultImpl
Implements the SqlResult interface. |
Field Summary | |
---|---|
private boolean |
checkNext
|
private boolean |
hasNext
|
private boolean |
isClosed
|
private int |
limit
|
private static Logger |
log
Logger. |
private ResultSet |
results
The results of the query. |
private int |
returnedRows
|
private SqlResult |
sqlResult
|
private long |
totalCount
The total number of items. |
Constructor Summary | |
---|---|
DynamicResultIterator(ResultSet results,
long totalCount,
int limit)
Create a new result iterator. |
Method Summary | |
---|---|
void |
close()
From the ResultIterator interface --------------------------------- |
int |
getIndex(String name)
Get the index number of a selected column. |
long |
getTotalCount()
From the QueryResult interface --------------------------------- |
boolean |
hasNext()
|
boolean |
isClosed()
Check if the iterator has been closed. |
SqlResult |
next()
Get the results in the next row. |
void |
remove()
Not supported. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger log
private final ResultSet results
private final long totalCount
private final int limit
private int returnedRows
private final SqlResult sqlResult
private boolean hasNext
private boolean checkNext
private boolean isClosed
Constructor Detail |
---|
DynamicResultIterator(ResultSet results, long totalCount, int limit)
results
- The ResultSet
object containing the
resultstotalCount
- The total number of rowslimit
- The maximum numbre of rows that was specified for the
queryMethod Detail |
---|
public long getTotalCount()
getTotalCount
in interface QueryResult
Query.setReturnTotalCount(boolean)
public void close()
close
in interface ResultIterator<SqlResult>
public boolean isClosed()
ResultIterator
isClosed
in interface ResultIterator<SqlResult>
public boolean hasNext()
hasNext
in interface Iterator<SqlResult>
public SqlResult next()
SqlResult
object
is always the same object. It just changes the underlying pointer to
the next row in the result set. If you need to store data from
a previous row you must copy the values to another place.
next
in interface Iterator<SqlResult>
SqlResult
object
NoSuchElementException
- If there are no more resultspublic void remove()
remove
in interface Iterator<SqlResult>
UnsupportedOperationException
- Alwayspublic int getIndex(String name) throws SQLException
SqlResultIterator
SqlResult.getXxx(index)
methods to get the value of that column.
getIndex
in interface SqlResultIterator
name
- The name of a selected column
SQLException
- If there is an error
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |