- All Superinterfaces:
Attachable,AttachableQueryPart,AutoCloseable,Query,QueryPart,Serializable,Statement
- All Known Subinterfaces:
CloseableResultQuery<R>
Query that holds a reference to the underlying
PreparedStatement without closing it, for reuse.
It was created via Query.keepStatement(boolean) and must be treated
as a resource, e.g. in a try-with-resources statement.
- Author:
- Lukas Eder
-
Method Summary
Modifier and TypeMethodDescription@NotNull CloseableQueryBind a new value to an indexed parameter.@NotNull CloseableQueryBind a new value to a named parameter.voidclose()Close the underlying statement.@NotNull CloseableQuerykeepStatement(boolean keepStatement) Keep the query's underlying statement open after execution.@NotNull CloseableQuerypoolable(boolean poolable) Specify whether any JDBCStatementcreated by this query should beStatement.setPoolable(boolean).@NotNull CloseableQueryqueryTimeout(int seconds) Specify the query timeout in number of seconds for the underlying JDBCStatement.Methods inherited from interface org.jooq.Attachable
attach, configuration, detachMethods inherited from interface org.jooq.AttachableQueryPart
getBindValues, getParam, getParams, getSQL, getSQLMethods inherited from interface org.jooq.Query
cancel, execute, executeAsync, executeAsync, isExecutable
-
Method Details
-
bind
@NotNull @NotNull CloseableQuery bind(String param, Object value) throws IllegalArgumentException, DataTypeException Description copied from interface:QueryBind a new value to a named parameter.[#1886] If the bind value with name
paramis inlined (Param.isInline()) or if this query was created withStatementType.STATIC_STATEMENTand there is an underlyingPreparedStatementkept open because ofQuery.keepStatement(boolean), the underlyingPreparedStatementwill be closed automatically in order for new bind values to have an effect.- Specified by:
bindin interfaceQuery- Parameters:
param- The named parameter name. If this is a number, then this is the same as callingQuery.bind(int, Object)value- The new bind value.- Throws:
IllegalArgumentException- if there is no parameter by the given parameter name or index.DataTypeException- ifvaluecannot be converted into the parameter's data type
-
bind
@NotNull @NotNull CloseableQuery bind(int index, Object value) throws IllegalArgumentException, DataTypeException Description copied from interface:QueryBind a new value to an indexed parameter.[#1886] If the bind value at
indexis inlined (Param.isInline()) or if this query was created withStatementType.STATIC_STATEMENTand there is an underlyingPreparedStatementkept open because ofQuery.keepStatement(boolean), the underlyingPreparedStatementwill be closed automatically in order for new bind values to have an effect.- Specified by:
bindin interfaceQuery- Parameters:
index- The parameter index, starting with 1value- The new bind value.- Throws:
IllegalArgumentException- if there is no parameter by the given parameter index.DataTypeException- ifvaluecannot be converted into the parameter's data type
-
poolable
Description copied from interface:QuerySpecify whether any JDBCStatementcreated by this query should beStatement.setPoolable(boolean).If this method is not called on jOOQ types, then jOOQ will not specify the flag on JDBC either, resulting in JDBC's default behaviour.
-
queryTimeout
Description copied from interface:QuerySpecify the query timeout in number of seconds for the underlying JDBCStatement.- Specified by:
queryTimeoutin interfaceQuery- See Also:
-
keepStatement
Description copied from interface:QueryKeep the query's underlying statement open after execution.This indicates to jOOQ that the query's underlying
StatementorPreparedStatementshould be kept open after execution. If it is kept open, client code is responsible for properly closing it usingclose(), e.g. via atry-with-resourcesstatement.- Specified by:
keepStatementin interfaceQuery- Parameters:
keepStatement- Whether to keep the underlying statement open
-
close
Close the underlying statement.This closes the query's underlying
StatementorPreparedStatementif a previous call tokeepStatement(boolean)indicated that jOOQ should keep statements open after query execution. If there is no underlying open statement, this call is simply ignored.- Specified by:
closein interfaceAutoCloseable- Throws:
DataAccessException- If something went wrong closing the statement- See Also:
-