|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.skife.jdbi.v2.SQLStatement<Query<ResultType>>
org.skife.jdbi.v2.Query<ResultType>
public class Query<ResultType>
Statement providing convenience result handling for SQL queries.
Method Summary | ||
---|---|---|
protected void |
addCleanable(Cleanable cleanable)
|
|
protected void |
addCustomizer(StatementCustomizer customizer)
|
|
protected void |
addCustomizers(Collection<StatementCustomizer> customizers)
|
|
protected void |
afterExecution(PreparedStatement stmt)
|
|
protected void |
beforeExecution(PreparedStatement stmt)
|
|
protected void |
cleanup()
|
|
Query<ResultType> |
fetchForward()
Specify that the fetch order should be forward, uses the underlying Statement.setFetchDirection(int) |
|
Query<ResultType> |
fetchReverse()
Specify that the fetch order should be reversed, uses the underlying Statement.setFetchDirection(int) |
|
ResultType |
first()
Executes the select. |
|
|
first(Class<T> containerType)
|
|
|
fold(AccumulatorType accumulator,
Folder2<AccumulatorType> folder)
Used to execute the query and traverse the result set with a accumulator. |
|
|
fold(AccumulatorType accumulator,
Folder3<AccumulatorType,ResultType> folder)
|
|
protected ConcreteStatementContext |
getConcreteContext()
|
|
StatementContext |
getContext()
Obtain the statement context associated with this statement |
|
protected org.skife.jdbi.v2.Foreman |
getForeman()
|
|
protected Collection<StatementCustomizer> |
getStatementCustomizers()
|
|
ResultIterator<ResultType> |
iterator()
Obtain a forward-only result set iterator. |
|
List<ResultType> |
list()
Executes the select Will eagerly load all results |
|
|
list(Class<ContainerType> containerType)
|
|
List<ResultType> |
list(int maxRows)
Executes the select Will eagerly load all results up to a maximum of maxRows |
|
|
map(Class<Type> resultType)
Provide basic JavaBean mapping capabilities. |
|
|
map(ResultSetMapper<T> mapper)
|
|
|
mapTo(Class<T> resultType)
Makes use of registered mappers to map the result set to the desired type. |
|
void |
registerMapper(ResultSetMapper m)
|
|
void |
registerMapper(ResultSetMapperFactory m)
|
|
Query<ResultType> |
setFetchSize(int fetchSize)
Specify the fetch size for the query. |
|
Query<ResultType> |
setMaxFieldSize(int maxFields)
Specify the maimum field size in the result set. |
|
Query<ResultType> |
setMaxRows(int maxRows)
Specify the maimum number of rows the query is to return. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public Query<ResultType> fetchForward()
Statement.setFetchDirection(int)
public Query<ResultType> fetchReverse()
Statement.setFetchDirection(int)
public ResultType first()
first
in interface ResultBearing<ResultType>
public <T> T first(Class<T> containerType)
first
in interface ResultBearing<ResultType>
public <AccumulatorType> AccumulatorType fold(AccumulatorType accumulator, Folder2<AccumulatorType> folder)
accumulator
- The initial accumulator valuefolder
- Defines the function which will fold over the result set.
Folder.fold(Object, java.sql.ResultSet)
Folder
public <AccumulatorType> AccumulatorType fold(AccumulatorType accumulator, Folder3<AccumulatorType,ResultType> folder)
public ResultIterator<ResultType> iterator()
iterator
in interface Iterable<ResultType>
iterator
in interface ResultBearing<ResultType>
public List<ResultType> list()
list
in interface ResultBearing<ResultType>
UnableToCreateStatementException
- if there is an error creating the statement
UnableToExecuteStatementException
- if there is an error executing the statement
ResultSetException
- if there is an error dealing with the result setpublic <ContainerType> ContainerType list(Class<ContainerType> containerType)
list
in interface ResultBearing<ResultType>
public List<ResultType> list(int maxRows)
maxRows
list
in interface ResultBearing<ResultType>
maxRows
- The maximum number of results to include in the result, any
rows in the result set beyond this number will be ignored.
UnableToCreateStatementException
- if there is an error creating the statement
UnableToExecuteStatementException
- if there is an error executing the statement
ResultSetException
- if there is an error dealing with the result setpublic <Type> Query<Type> map(Class<Type> resultType)
resultType
- JavaBean class to map result set fields into the properties of, by name
public <T> Query<T> map(ResultSetMapper<T> mapper)
public <T> Query<T> mapTo(Class<T> resultType)
resultType
- the type to map the query results to
DBI.registerMapper(org.skife.jdbi.v2.tweak.ResultSetMapper)
,
DBI.registerMapper(ResultSetMapperFactory)
,
Handle.registerMapper(ResultSetMapperFactory)
,
Handle.registerMapper(org.skife.jdbi.v2.tweak.ResultSetMapper)
public void registerMapper(ResultSetMapper m)
public void registerMapper(ResultSetMapperFactory m)
public Query<ResultType> setFetchSize(int fetchSize)
i
- the number of rows to fetch in a bunch
public Query<ResultType> setMaxFieldSize(int maxFields)
Statement.setMaxFieldSize(int)
i
- maximum field size
public Query<ResultType> setMaxRows(int maxRows)
Statement.setMaxRows(int)
}.
i
- maximum number of rows to return
protected void addCleanable(Cleanable cleanable)
protected void addCustomizer(StatementCustomizer customizer)
protected void addCustomizers(Collection<StatementCustomizer> customizers)
protected final void afterExecution(PreparedStatement stmt)
protected final void beforeExecution(PreparedStatement stmt)
protected final void cleanup()
protected final ConcreteStatementContext getConcreteContext()
public final StatementContext getContext()
protected final org.skife.jdbi.v2.Foreman getForeman()
protected Collection<StatementCustomizer> getStatementCustomizers()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |