org.ametys.plugins.datainclusion.data.sql
Class LazySqlQueryResult

java.lang.Object
  extended by org.ametys.plugins.datainclusion.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
protected  ResultSet _resultSet
          The wrapped ResultSet
protected  Query.ResultType _resultType
          The result type.
 
Constructor Summary
LazySqlQueryResult(ResultSet resultSet)
          Constructs a query result around a ResultSet.
 
Method Summary
protected  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.
 Collection<String> getColumnNames()
          Get the column names.
 Query.ResultType getType()
          Get the type of the result.
 boolean hasNext()
           
 Iterator<QueryResultRow> iterator()
           
 QueryResultRow 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
 

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 a ResultSet.

Parameters:
resultSet -
Method Detail

getType

public Query.ResultType getType()
Description copied from interface: QueryResult
Get the type of the result.

Specified by:
getType in interface QueryResult
Returns:
the result type.

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 interface QueryResult
Returns:
the column names as a Collection.
Throws:
DataInclusionException

iterator

public Iterator<QueryResultRow> iterator()
Specified by:
iterator in interface Iterable<QueryResultRow>

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<QueryResultRow>

next

public QueryResultRow next()
Specified by:
next in interface Iterator<QueryResultRow>

remove

public void remove()
Specified by:
remove in interface Iterator<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 interface QueryResult

_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


Copyright © 2010 Anyware Services. All Rights Reserved.