public class Query<ResultType> extends SQLStatement<Query<ResultType>> implements ResultBearing<ResultType>
Modifier and Type | Method and Description |
---|---|
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> |
concurrentUpdatable()
Specify that the result set should be concurrent updatable.
|
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.
|
<T> T |
first(Class<T> containerType) |
<AccumulatorType> |
fold(AccumulatorType accumulator,
Folder2<AccumulatorType> folder)
Used to execute the query and traverse the result set with a accumulator.
|
<AccumulatorType> |
fold(AccumulatorType accumulator,
Folder3<AccumulatorType,ResultType> folder) |
protected ConcreteStatementContext |
getConcreteContext() |
StatementContext |
getContext()
Obtain the statement context associated with this statement
|
protected 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
|
<ContainerType> |
list(Class<ContainerType> containerType) |
List<ResultType> |
list(int maxRows)
Executes the select
Will eagerly load all results up to a maximum of
maxRows |
<Type> Query<Type> |
map(Class<Type> resultType)
Provide basic JavaBean mapping capabilities.
|
<T> Query<T> |
map(ResultColumnMapper<T> mapper) |
<T> Query<T> |
map(ResultSetMapper<T> mapper) |
<T> Query<T> |
mapTo(Class<T> resultType)
Makes use of registered mappers to map the result set to the desired type.
|
void |
registerColumnMapper(ResultColumnMapper m) |
void |
registerColumnMapper(ResultColumnMapperFactory m) |
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.
|
addStatementCustomizer, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bind, bindASCIIStream, bindASCIIStream, bindAsInt, bindAsInt, bindAsInt, bindAsInt, bindBinaryStream, bindBinaryStream, bindBySqlType, bindBySqlType, bindFromMap, bindFromProperties, bindNamedArgumentFinder, bindNull, bindNull, cleanupHandle, cleanupHandle, clearBindings, define, define, dynamicBind, getContainerMapperRegistry, getHandle, getLog, getParams, getRewriter, getSql, getStatementBuilder, getStatementLocator, getTimingCollector, internalExecute, registerArgumentFactory, registerContainerFactory, setFetchDirection, setFetchDirection2, setQueryTimeout, setStatementLocator, setStatementLocator2, setStatementRewriter, setStatementRewriter2
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public Query<ResultType> concurrentUpdatable()
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 statementUnableToExecuteStatementException
- if there is an error executing the statementResultSetException
- 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 statementUnableToExecuteStatementException
- if there is an error executing the statementResultSetException
- 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 namepublic <T> Query<T> map(ResultColumnMapper<T> mapper)
public <T> Query<T> map(ResultSetMapper<T> mapper)
public <T> Query<T> mapTo(Class<T> resultType)
resultType
- the type to map the query results toDBI.registerMapper(org.skife.jdbi.v2.tweak.ResultSetMapper)
,
DBI.registerMapper(ResultSetMapperFactory)
,
Handle.registerMapper(ResultSetMapperFactory)
,
Handle.registerMapper(org.skife.jdbi.v2.tweak.ResultSetMapper)
public void registerColumnMapper(ResultColumnMapper m)
public void registerColumnMapper(ResultColumnMapperFactory m)
public void registerMapper(ResultSetMapper m)
public void registerMapper(ResultSetMapperFactory m)
public Query<ResultType> setFetchSize(int fetchSize)
fetchSize
- the number of rows to fetch in a bunchpublic Query<ResultType> setMaxFieldSize(int maxFields)
Statement.setMaxFieldSize(int)
maxFields
- maximum field sizepublic Query<ResultType> setMaxRows(int maxRows)
Statement.setMaxRows(int)
}.maxRows
- maximum number of rows to returnprotected 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 Foreman getForeman()
protected Collection<StatementCustomizer> getStatementCustomizers()
Copyright © 2018. All rights reserved.