com.j256.ormlite.dao
Interface GenericRawResults<T>

All Superinterfaces:
CloseableIterable<T>, Iterable<T>
All Known Implementing Classes:
RawResultsImpl

public interface GenericRawResults<T>
extends CloseableIterable<T>

Results returned by a call to Dao.queryRaw(String, String...) which returns results as a String[], Dao.queryRaw(String, RawRowMapper, String...) which returns results mapped by the caller to an Object, and Dao.queryRaw(String, DataType[], String...) which returns each results as a Object[].

You can access the results one of two ways using this object. You can call the getResults() method which will extract all results into a list which is returned. Or you can call the CloseableIterable.iterator() method either directly or with the for... Java statement. The iterator allows you to page through the results and is more appropriate for queries which will return a large number of results.

NOTE: If you access the CloseableIterable.iterator() method, you must call CloseableIterator.close() method when you are done otherwise the underlying SQL statement and connection may be kept open.

Author:
graywatson

Method Summary
 void close()
          Close any open database connections associated with the RawResults.
 String[] getColumnNames()
          Return the array of column names for each result row.
 int getNumberColumns()
          Return the number of columns in each result row.
 List<T> getResults()
          Return a list of all of the results.
 
Methods inherited from interface com.j256.ormlite.dao.CloseableIterable
iterator
 

Method Detail

getNumberColumns

int getNumberColumns()
Return the number of columns in each result row.


getColumnNames

String[] getColumnNames()
Return the array of column names for each result row.


getResults

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

Throws:
SQLException

close

void close()
           throws SQLException
Close any open database connections associated with the RawResults. This is only applicable if the Dao.iteratorRaw(String) or another iterator method was called.

Throws:
SQLException


Copyright © 2011. All Rights Reserved.