com.j256.ormlite.stmt
Class RawResultsImpl<T>

java.lang.Object
  extended by com.j256.ormlite.stmt.RawResultsImpl<T>
All Implemented Interfaces:
CloseableIterable<T>, CloseableWrappedIterable<T>, GenericRawResults<T>, Iterable<T>

public class RawResultsImpl<T>
extends Object
implements GenericRawResults<T>

Handler for our raw results objects which does the conversion for various different results: String[], Object[], and user defined .

Author:
graywatson

Constructor Summary
RawResultsImpl(ConnectionSource connectionSource, DatabaseConnection connection, String query, Class<?> clazz, CompiledStatement compiledStmt, GenericRowMapper<T> rowMapper, ObjectCache objectCache)
           
 
Method Summary
 void close()
          Close any open database connections associated with the GenericRawResults.
 CloseableIterator<T> closeableIterator()
          Returns an iterator over a set of elements of type T which can be closed.
 String[] getColumnNames()
          Return the array of column names for each result row.
 T getFirstResult()
          Return the first result only.
 int getNumberColumns()
          Return the number of columns in each result row.
 List<T> getResults()
          Return a list of all of the results.
 CloseableIterator<T> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RawResultsImpl

public RawResultsImpl(ConnectionSource connectionSource,
                      DatabaseConnection connection,
                      String query,
                      Class<?> clazz,
                      CompiledStatement compiledStmt,
                      GenericRowMapper<T> rowMapper,
                      ObjectCache objectCache)
               throws SQLException
Throws:
SQLException
Method Detail

getNumberColumns

public int getNumberColumns()
Description copied from interface: GenericRawResults
Return the number of columns in each result row.

Specified by:
getNumberColumns in interface GenericRawResults<T>

getColumnNames

public String[] getColumnNames()
Description copied from interface: GenericRawResults
Return the array of column names for each result row.

Specified by:
getColumnNames in interface GenericRawResults<T>

getResults

public List<T> getResults()
                   throws SQLException
Description copied from interface: GenericRawResults
Return a list of all of the results. For large queries, this should not be used since the Iterable.iterator() method will allow your to process the results page-by-page.

Specified by:
getResults in interface GenericRawResults<T>
Throws:
SQLException

getFirstResult

public T getFirstResult()
                 throws SQLException
Description copied from interface: GenericRawResults
Return the first result only. This should be used if you are only expecting one result. It cannot be used in conjunction with GenericRawResults.getResults().

Specified by:
getFirstResult in interface GenericRawResults<T>
Returns:
null if there are no results.
Throws:
SQLException

iterator

public CloseableIterator<T> iterator()
Specified by:
iterator in interface Iterable<T>

closeableIterator

public CloseableIterator<T> closeableIterator()
Description copied from interface: CloseableIterable
Returns an iterator over a set of elements of type T which can be closed.

Specified by:
closeableIterator in interface CloseableIterable<T>

close

public void close()
           throws SQLException
Description copied from interface: GenericRawResults
Close any open database connections associated with the GenericRawResults. This is only necessary if the Dao.iterator() or another iterator method was called.

Specified by:
close in interface CloseableWrappedIterable<T>
Specified by:
close in interface GenericRawResults<T>
Throws:
SQLException


This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.