Class LazySqlQueryResult
- java.lang.Object
 - 
- org.ametys.plugins.externaldata.data.sql.LazySqlQueryResult
 
 
- 
- All Implemented Interfaces:
 Iterable<QueryResultRow>,Iterator<QueryResultRow>,QueryResult
public class LazySqlQueryResult extends Object implements QueryResult, Iterator<QueryResultRow>
SQL query result. 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected ResultSet_resultSetThe wrapped ResultSetprotected Query.ResultType_resultTypeThe result type. 
- 
Constructor Summary
Constructors Constructor Description LazySqlQueryResult(ResultSet resultSet)Constructs a query result around aResultSet. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Collection<String>_extractColumnNames(ResultSet resultSet)Extract the column names of a JDBC result set.voidclose()Close and cleanup the underlying objects and resources (resultset if SQL, LDAP resources...) if needed.Collection<String>getColumnNames()Get the column names.intgetSize()Get sizeQuery.ResultTypegetType()Get the type of the result.booleanhasNext()Iterator<QueryResultRow>iterator()QueryResultRownext()voidremove()voidsetType(Query.ResultType resultType)Set the result type.- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface java.lang.Iterable
forEach, spliterator 
- 
Methods inherited from interface java.util.Iterator
forEachRemaining 
 - 
 
 - 
 
- 
- 
Field Detail
- 
_resultType
protected Query.ResultType _resultType
The result type. 
- 
_resultSet
protected ResultSet _resultSet
The wrapped ResultSet 
 - 
 
- 
Constructor Detail
- 
LazySqlQueryResult
public LazySqlQueryResult(ResultSet resultSet)
Constructs a query result around aResultSet.- Parameters:
 resultSet- the result set
 
 - 
 
- 
Method Detail
- 
getType
public Query.ResultType getType()
Description copied from interface:QueryResultGet the type of the result.- Specified by:
 getTypein interfaceQueryResult- Returns:
 - the result type.
 
 
- 
getSize
public int getSize()
Description copied from interface:QueryResultGet size- Specified by:
 getSizein interfaceQueryResult- Returns:
 - the size
 
 
- 
setType
public void setType(Query.ResultType resultType)
Set the result type.- Parameters:
 resultType- the result type.
 
- 
getColumnNames
public Collection<String> getColumnNames() throws DataInclusionException
Description copied from interface:QueryResultGet the column names.- Specified by:
 getColumnNamesin interfaceQueryResult- Returns:
 - the column names as a Collection.
 - Throws:
 DataInclusionException- if an error occurs while manipulating the data sources
 
- 
iterator
public Iterator<QueryResultRow> iterator()
- Specified by:
 iteratorin interfaceIterable<QueryResultRow>
 
- 
hasNext
public boolean hasNext()
- Specified by:
 hasNextin interfaceIterator<QueryResultRow>
 
- 
next
public QueryResultRow next()
- Specified by:
 nextin interfaceIterator<QueryResultRow>
 
- 
remove
public void remove()
- Specified by:
 removein interfaceIterator<QueryResultRow>
 
- 
close
public void close()
Description copied from interface:QueryResultClose and cleanup the underlying objects and resources (resultset if SQL, LDAP resources...) if needed.- Specified by:
 closein interfaceQueryResult
 
- 
_extractColumnNames
protected Collection<String> _extractColumnNames(ResultSet resultSet) throws SQLException
Extract the column names of a JDBC result set.- Parameters:
 resultSet- the JDBC result set.- Returns:
 - the column names as a Collection.
 - Throws:
 SQLException- if an exception occurs when manipulating the result set
 
 - 
 
 -