- 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 SummaryModifier 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.Attachableattach, configuration, detachMethods inherited from interface org.jooq.AttachableQueryPartgetBindValues, getParam, getParams, getSQL, getSQLMethods inherited from interface org.jooq.Querycancel, 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 interface- Query
- Parameters:
- param- The named parameter name. If this is a number, then this is the same as calling- Query.bind(int, Object)
- value- The new bind value.
- Throws:
- IllegalArgumentException- if there is no parameter by the given parameter name or index.
- DataTypeException- if- valuecannot 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.Bind index orderThe 1-based parameter index describes a parameter in rendering order, not in input order. For example, if a query contains aDSL.log(Field, Field)call, where the first argument is thevalueand the second argument is thebase, this may produce different dialect specific renderings:- Db2: ln(value) / ln(base)
- Oracle: log(base, value)
- SQL Server: log(value, base)
 Some bind values may even be repeated by a dialect specific emulation, leading to duplication and index-shifting. As such, it is usually better to supply bind values directly with the input of an expression, e.g.: - Directly with the DSLmethod, such asDSL.log(Field, Field), for example.
- With the plain SQL template constructor, e.g.
 DSL.field(String, Object...)
- With the parser method, e.g.
 Parser.parseField(String, Object...)
 Inlined values[#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 interface- Query
- Parameters:
- index- The parameter index in rendering order, starting with 1
- value- The new bind value.
- Throws:
- IllegalArgumentException- if there is no parameter by the given parameter index.
- DataTypeException- if- valuecannot be converted into the parameter's data type
 
- Db2: 
- 
poolableDescription 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. 
- 
queryTimeoutDescription copied from interface:QuerySpecify the query timeout in number of seconds for the underlying JDBCStatement.- Specified by:
- queryTimeoutin interface- Query
- See Also:
 
- 
keepStatementDescription 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 interface- Query
- Parameters:
- keepStatement- Whether to keep the underlying statement open
 
- 
closeClose 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 interface- AutoCloseable
- Throws:
- DataAccessException- If something went wrong closing the statement
- See Also:
 
 
-