Class SqlQueryResult
- java.lang.Object
-
- org.ametys.plugins.externaldata.data.sql.SqlQueryResult
-
- All Implemented Interfaces:
Iterable<QueryResultRow>
,QueryResult
public class SqlQueryResult extends Object implements QueryResult
SQL query result.
-
-
Field Summary
Fields Modifier and Type Field Description protected Query.ResultType
_resultType
The result type.protected List<QueryResultRow>
_rows
The result rows.
-
Constructor Summary
Constructors Constructor Description SqlQueryResult(ResultSet resultSet)
Constructs a query result around a ResultSet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_extractResults(ResultSet resultSet)
Extract the column names and results from a JDBC result set.void
close()
Close and cleanup the underlying objects and resources (resultset if SQL, LDAP resources...) if needed.Collection<String>
getColumnNames()
Get the column names.int
getSize()
Get sizeQuery.ResultType
getType()
Get the type of the result.Iterator<QueryResultRow>
iterator()
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
-
-
-
-
Field Detail
-
_resultType
protected Query.ResultType _resultType
The result type.
-
_rows
protected List<QueryResultRow> _rows
The result rows.
-
-
Constructor Detail
-
SqlQueryResult
public SqlQueryResult(ResultSet resultSet)
Constructs a query result around a ResultSet.- Parameters:
resultSet
- the result set
-
-
Method Detail
-
getType
public Query.ResultType getType()
Description copied from interface:QueryResult
Get the type of the result.- Specified by:
getType
in interfaceQueryResult
- Returns:
- the result type.
-
getSize
public int getSize()
Description copied from interface:QueryResult
Get size- Specified by:
getSize
in 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: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
public Iterator<QueryResultRow> iterator()
- Specified by:
iterator
in interfaceIterable<QueryResultRow>
-
close
public void 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
-
_extractResults
protected void _extractResults(ResultSet resultSet) throws SQLException
Extract the column names and results from a JDBC result set.- Parameters:
resultSet
- the JDBC result set.- Throws:
SQLException
- if an error occurs when manipulating the result set
-
-