public class DynamicResultIterator extends java.lang.Object implements SqlResultIterator
AbstractSqlQuery
.AbstractSqlQuery.iterate(DbControl)
Modifier and Type | Class and Description |
---|---|
private class |
DynamicResultIterator.SqlResultImpl
Implements the SqlResult interface.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
checkNext |
private boolean |
hasNext |
private boolean |
isClosed |
private int |
limit |
private static org.slf4j.Logger |
log
Logger.
|
private java.sql.ResultSet |
results
The results of the query.
|
private int |
returnedRows |
private SqlResult |
sqlResult |
private long |
totalCount
The total number of items.
|
Constructor and Description |
---|
DynamicResultIterator(java.sql.ResultSet results,
long totalCount,
int limit)
Create a new result iterator.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
From the ResultIterator interface
---------------------------------
|
int |
getIndex(java.lang.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.
|
private static final org.slf4j.Logger log
private final java.sql.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
DynamicResultIterator(java.sql.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
querypublic 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 java.util.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 java.util.Iterator<SqlResult>
SqlResult
objectjava.util.NoSuchElementException
- If there are no more resultspublic void remove()
remove
in interface java.util.Iterator<SqlResult>
java.lang.UnsupportedOperationException
- Alwayspublic int getIndex(java.lang.String name) throws java.sql.SQLException
SqlResultIterator
SqlResult.getXxx(index)
methods to get the value of that column.getIndex
in interface SqlResultIterator
name
- The name of a selected columnjava.sql.SQLException
- If there is an error