Class LazySqlQueryResult
java.lang.Object
org.ametys.plugins.externaldata.data.sql.LazySqlQueryResult
- All Implemented Interfaces:
Iterable<QueryResultRow>
,Iterator<QueryResultRow>
,QueryResult
SQL query result.
-
Field Summary
Modifier and TypeFieldDescriptionprotected ResultSet
The wrapped ResultSetprotected Query.ResultType
The result type. -
Constructor Summary
ConstructorDescriptionLazySqlQueryResult
(ResultSet resultSet) Constructs a query result around aResultSet
. -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<String>
_extractColumnNames
(ResultSet resultSet) Extract the column names of a JDBC result set.void
close()
Close and cleanup the underlying objects and resources (resultset if SQL, LDAP resources...) if needed.Get the column names.int
getSize()
Get sizegetType()
Get the type of the result.boolean
hasNext()
iterator()
next()
void
remove()
void
setType
(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 Details
-
_resultType
The result type. -
_resultSet
The wrapped ResultSet
-
-
Constructor Details
-
LazySqlQueryResult
Constructs a query result around aResultSet
.- Parameters:
resultSet
- the result set
-
-
Method Details
-
getType
Description copied from interface:QueryResult
Get the type of the result.- Specified by:
getType
in interfaceQueryResult
- Returns:
- the result type.
-
getSize
Description copied from interface:QueryResult
Get size- Specified by:
getSize
in interfaceQueryResult
- Returns:
- the size
-
setType
Set the result type.- Parameters:
resultType
- the result type.
-
getColumnNames
Description copied from interface:QueryResult
Get the column names.- Specified by:
getColumnNames
in interfaceQueryResult
- Returns:
- the column names as a Collection.
- Throws:
DataInclusionException
- if an error occurs while manipulating the data sources
-
iterator
- Specified by:
iterator
in interfaceIterable<QueryResultRow>
-
hasNext
- Specified by:
hasNext
in interfaceIterator<QueryResultRow>
-
next
- Specified by:
next
in interfaceIterator<QueryResultRow>
-
remove
- Specified by:
remove
in interfaceIterator<QueryResultRow>
-
close
Description copied from interface:QueryResult
Close and cleanup the underlying objects and resources (resultset if SQL, LDAP resources...) if needed.- Specified by:
close
in interfaceQueryResult
-
_extractColumnNames
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
-