Package org.jdbi.v3.core.statement
Class Query
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Configurable<Query>
,ResultBearing
Statement providing convenience result handling for SQL queries.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Specify that the result set should be concurrent updatable.<R> R
execute
(ResultProducer<R> producer) Executes the query, returning the result obtained from the givenResultProducer
.Returns the configuration registry associated with this object.final StatementContext
Returns the statement context associated with this statement.<R> R
scanResultSet
(ResultSetScanner<R> mapper) Invokes the mapper with a result set supplier, and returns the value returned by the mapper.setFetchSize
(int fetchSize) Specify the fetch size for the query.setMaxFieldSize
(int maxFields) Specify the maximum field size in the result set.setMaxRows
(int maxRows) Specify the maximum number of rows the query is to return.Methods inherited from class org.jdbi.v3.core.statement.SqlStatement
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, bind, bind, bind, bind, bindArray, bindArray, bindArray, bindArray, bindArray, bindArray, bindArray, bindArray, bindASCIIStream, bindASCIIStream, bindBean, bindBean, bindBeanList, bindBinaryStream, bindBinaryStream, bindBySqlType, bindBySqlType, bindByType, bindByType, bindByType, bindByType, bindByType, bindByType, bindFields, bindFields, bindList, bindList, bindList, bindList, bindList, bindList, bindList, bindMap, bindMethods, bindMethods, bindMethodsList, bindNamedArgumentFinder, bindNull, bindNull, bindNVarchar, bindNVarchar, bindPojo, bindPojo, bindPojo, bindPojo, bindPojo, bindPojo, cleanupHandleCommit, cleanupHandleRollback, defineList, defineList, defineNamedBindings, setQueryTimeout
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jdbi.v3.core.config.Configurable
addCustomizer, configure, define, getConfig, registerArgument, registerArgument, registerArrayType, registerArrayType, registerArrayType, registerArrayType, registerCodecFactory, registerCollector, registerColumnMapper, registerColumnMapper, registerColumnMapper, registerColumnMapper, registerColumnMapper, registerColumnMapper, registerExtension, registerRowMapper, registerRowMapper, registerRowMapper, registerRowMapper, setMapKeyColumn, setMapValueColumn, setSqlArrayArgumentStrategy, setSqlLogger, setSqlParser, setTemplateEngine
Methods inherited from interface org.jdbi.v3.core.result.ResultBearing
collectInto, collectInto, collectInto, collectRows, map, map, map, mapTo, mapTo, mapTo, mapTo, mapToBean, mapToMap, mapToMap, mapToMap, reduceResultSet, reduceRows, reduceRows, reduceRows
-
Constructor Details
-
Query
-
-
Method Details
-
execute
Executes the query, returning the result obtained from the givenResultProducer
.- Type Parameters:
R
- the type of the result- Parameters:
producer
- the result producer.- Returns:
- value returned by the result producer.
-
scanResultSet
Description copied from interface:ResultBearing
Invokes the mapper with a result set supplier, and returns the value returned by the mapper.- Specified by:
scanResultSet
in interfaceResultBearing
- Type Parameters:
R
- result type returned by the mapper.- Parameters:
mapper
- result set scanner- Returns:
- the value returned by the mapper.
-
setFetchSize
Specify the fetch size for the query. This should cause the results to be fetched from the underlying RDBMS in groups of rows equal to the number passed. This is useful for doing chunked streaming of results when exhausting memory could be a problem.- Parameters:
fetchSize
- the number of rows to fetch in a bunch- Returns:
- the modified query
-
setMaxRows
Specify the maximum number of rows the query is to return. This uses the underlying JDBCStatement.setMaxRows(int)
}.- Parameters:
maxRows
- maximum number of rows to return- Returns:
- modified query
-
setMaxFieldSize
Specify the maximum field size in the result set. This uses the underlying JDBCStatement.setMaxFieldSize(int)
- Parameters:
maxFields
- maximum field size- Returns:
- modified query
-
concurrentUpdatable
Specify that the result set should be concurrent updatable. This will allow the update methods to be called on the result set produced by this Query.- Returns:
- the modified query
-
getHandle
-
getConfig
Description copied from interface:Configurable
Returns the configuration registry associated with this object.- Specified by:
getConfig
in interfaceConfigurable<This>
- Returns:
- the configuration registry associated with this object.
-
getContext
Returns the statement context associated with this statement.- Returns:
- the statement context associated with this statement.
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-