- All Superinterfaces:
Attachable
,AttachableQueryPart
,QueryPart
,Serializable
,Statement
- All Known Subinterfaces:
AlterDatabaseFinalStep
,AlterDomainDropConstraintCascadeStep
,AlterDomainFinalStep
,AlterIndexFinalStep
,AlterSchemaFinalStep
,AlterSequenceFinalStep
,AlterSequenceFlagsStep<T>
,AlterSequenceStep<T>
,AlterTableAddStep
,AlterTableDropStep
,AlterTableFinalStep
,AlterTableUsingIndexStep
,AlterTypeFinalStep
,AlterViewFinalStep
,Block
,CallArgsStep
,CloseableQuery
,CloseableResultQuery<R>
,CommentOnFinalStep
,CreateDatabaseFinalStep
,CreateDomainConstraintStep
,CreateDomainDefaultStep<T>
,CreateDomainFinalStep
,CreateIndexFinalStep
,CreateIndexIncludeStep
,CreateIndexWhereStep
,CreateSchemaFinalStep
,CreateSequenceAsStep<T>
,CreateSequenceFinalStep
,CreateSequenceFlagsStep<T>
,CreateTableAsStep
,CreateTableCommentStep
,CreateTableElementListStep
,CreateTableFinalStep
,CreateTableOnCommitStep
,CreateTableStorageStep
,CreateTableWithDataStep
,CreateTypeFinalStep
,CreateViewFinalStep
,DDLQuery
,Delete<R>
,DeleteConditionStep<R>
,DeleteFinalStep<R>
,DeleteLimitStep<R>
,DeleteOrderByStep<R>
,DeleteQuery<R>
,DeleteResultStep<R>
,DeleteReturningStep<R>
,DeleteUsingStep<R>
,DeleteWhereStep<R>
,DMLQuery<R>
,DropDatabaseFinalStep
,DropDomainCascadeStep
,DropDomainFinalStep
,DropIndexCascadeStep
,DropIndexFinalStep
,DropIndexOnStep
,DropSchemaFinalStep
,DropSchemaStep
,DropSequenceFinalStep
,DropTableFinalStep
,DropTableStep
,DropTriggerOnStep
,DropTypeFinalStep
,DropTypeStep
,DropViewFinalStep
,GrantFinalStep
,GrantWithGrantOptionStep
,Insert<R>
,InsertFinalStep<R>
,InsertOnConflictConditionStep<R>
,InsertOnConflictWhereStep<R>
,InsertOnDuplicateSetMoreStep<R>
,InsertOnDuplicateStep<R>
,InsertQuery<R>
,InsertResultStep<R>
,InsertReturningStep<R>
,InsertSetMoreStep<R>
,InsertValuesStep1<R,
,T1> InsertValuesStep10<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> InsertValuesStep11<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> InsertValuesStep12<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> InsertValuesStep13<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> InsertValuesStep14<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> InsertValuesStep15<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> InsertValuesStep16<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> InsertValuesStep17<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> InsertValuesStep18<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> InsertValuesStep19<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> InsertValuesStep2<R,
,T1, T2> InsertValuesStep20<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> InsertValuesStep21<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> InsertValuesStep22<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> InsertValuesStep3<R,
,T1, T2, T3> InsertValuesStep4<R,
,T1, T2, T3, T4> InsertValuesStep5<R,
,T1, T2, T3, T4, T5> InsertValuesStep6<R,
,T1, T2, T3, T4, T5, T6> InsertValuesStep7<R,
,T1, T2, T3, T4, T5, T6, T7> InsertValuesStep8<R,
,T1, T2, T3, T4, T5, T6, T7, T8> InsertValuesStep9<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9> InsertValuesStepN<R>
,Merge<R>
,MergeFinalStep<R>
,MergeMatchedDeleteStep<R>
,MergeMatchedSetMoreStep<R>
,MergeMatchedStep<R>
,MergeMatchedWhereStep<R>
,MergeNotMatchedSetMoreStep<R>
,MergeNotMatchedStep<R>
,MergeNotMatchedWhereStep<R>
,MergeOnConditionStep<R>
,QOM.AlterDatabase
,QOM.AlterDomain<T>
,QOM.AlterIndex
,QOM.AlterSchema
,QOM.AlterSequence<T>
,QOM.AlterType
,QOM.AlterView
,QOM.Call
,QOM.CommentOn
,QOM.Commit
,QOM.CreateDatabase
,QOM.CreateDomain<T>
,QOM.CreateFunction
,QOM.CreateIndex
,QOM.CreateProcedure
,QOM.CreateSchema
,QOM.CreateSequence<T>
,QOM.CreateSynonym
,QOM.CreateTable
,QOM.CreateTrigger
,QOM.CreateType
,QOM.CreateView<R>
,QOM.Delete<R>
,QOM.DeleteReturning<R>
,QOM.DropDatabase
,QOM.DropDomain
,QOM.DropFunction
,QOM.DropIndex
,QOM.DropProcedure
,QOM.DropSchema
,QOM.DropSequence
,QOM.DropSynonym
,QOM.DropTable
,QOM.DropTrigger
,QOM.DropType
,QOM.DropView
,QOM.Grant
,QOM.Insert<R>
,QOM.InsertReturning<R>
,QOM.ReleaseSavepoint
,QOM.Revoke
,QOM.Rollback
,QOM.Savepoint
,QOM.SetCatalog
,QOM.SetCommand
,QOM.SetSchema
,QOM.StartTransaction
,QOM.Truncate<R>
,QOM.Update<R>
,QOM.UpdateReturning<R>
,ResultQuery<R>
,RevokeFinalStep
,RollbackToSavepointStep
,RowCountQuery
,Select<R>
,SelectConditionStep<R>
,SelectConnectByAfterStartWithConditionStep<R>
,SelectConnectByConditionStep<R>
,SelectConnectByStep<R>
,SelectCorrelatedSubqueryStep<R>
,SelectDistinctOnStep<R>
,SelectFinalStep<R>
,SelectForJSONCommonDirectivesStep<R>
,SelectForStep<R>
,SelectForUpdateOfStep<R>
,SelectForUpdateStep<R>
,SelectForUpdateWaitStep<R>
,SelectForXMLCommonDirectivesStep<R>
,SelectForXMLPathDirectivesStep<R>
,SelectForXMLRawDirectivesStep<R>
,SelectFromStep<R>
,SelectGroupByStep<R>
,SelectHavingConditionStep<R>
,SelectHavingStep<R>
,SelectIntoStep<R>
,SelectJoinStep<R>
,SelectLimitAfterOffsetStep<R>
,SelectLimitPercentAfterOffsetStep<R>
,SelectLimitPercentStep<R>
,SelectLimitStep<R>
,SelectOffsetStep<R>
,SelectOnConditionStep<R>
,SelectOptionalOnStep<R>
,SelectOptionStep<R>
,SelectOrderByStep<R>
,SelectQualifyConditionStep<R>
,SelectQualifyStep<R>
,SelectQuery<R>
,SelectSeekLimitStep<R>
,SelectSeekStep1<R,
,T1> SelectSeekStep10<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> SelectSeekStep11<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> SelectSeekStep12<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> SelectSeekStep13<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> SelectSeekStep14<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> SelectSeekStep15<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> SelectSeekStep16<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> SelectSeekStep17<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> SelectSeekStep18<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> SelectSeekStep19<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> SelectSeekStep2<R,
,T1, T2> SelectSeekStep20<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> SelectSeekStep21<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> SelectSeekStep22<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> SelectSeekStep3<R,
,T1, T2, T3> SelectSeekStep4<R,
,T1, T2, T3, T4> SelectSeekStep5<R,
,T1, T2, T3, T4, T5> SelectSeekStep6<R,
,T1, T2, T3, T4, T5, T6> SelectSeekStep7<R,
,T1, T2, T3, T4, T5, T6, T7> SelectSeekStep8<R,
,T1, T2, T3, T4, T5, T6, T7, T8> SelectSeekStep9<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9> SelectSeekStepN<R>
,SelectSelectStep<R>
,SelectStartWithStep<R>
,SelectUnionStep<R>
,SelectWhereStep<R>
,SelectWindowStep<R>
,SelectWithTiesAfterOffsetStep<R>
,SelectWithTiesStep<R>
,StoreQuery<R>
,Truncate<R>
,TruncateCascadeStep<R>
,TruncateFinalStep<R>
,TruncateIdentityStep<R>
,Update<R>
,UpdateConditionStep<R>
,UpdateFinalStep<R>
,UpdateFromStep<R>
,UpdateLimitStep<R>
,UpdateOrderByStep<R>
,UpdateQuery<R>
,UpdateResultStep<R>
,UpdateReturningStep<R>
,UpdateSetMoreStep<R>
,UpdateWhereStep<R>
Instances can be created using DSL.query(String)
and overloads,
or by creating a subtype.
- Author:
- Lukas Eder
-
Method Summary
Modifier and TypeMethodDescription@NotNull Query
Bind a new value to an indexed parameter.@NotNull Query
Bind a new value to a named parameter.void
cancel()
Cancel the underlying statement.int
execute()
Execute the query, if it has been created with a proper configuration.@NotNull CompletionStage
<Integer> Execute the query in a newCompletionStage
.@NotNull CompletionStage
<Integer> executeAsync
(Executor executor) Execute the query in a newCompletionStage
that is asynchronously completed by a task running in the given executor.boolean
Whether this query is executable in its current state.@NotNull CloseableQuery
keepStatement
(boolean keepStatement) Keep the query's underlying statement open after execution.@NotNull Query
poolable
(boolean poolable) Specify whether any JDBCStatement
created by this query should beStatement.setPoolable(boolean)
.@NotNull Query
queryTimeout
(int seconds) Specify the query timeout in number of seconds for the underlying JDBCStatement
.Methods inherited from interface org.jooq.Attachable
attach, configuration, detach
Methods inherited from interface org.jooq.AttachableQueryPart
getBindValues, getParam, getParams, getSQL, getSQL
-
Method Details
-
execute
Execute the query, if it has been created with a proper configuration.- Returns:
- A result value, depending on the concrete implementation of
Query
: - Throws:
DataAccessException
- If anything goes wrong in the database
-
executeAsync
Execute the query in a newCompletionStage
.The result is asynchronously completed by a task running in an
Executor
provided by the underlyingConfiguration.executorProvider()
.- Returns:
- A result value, depending on the concrete implementation of
Query
:
-
executeAsync
Execute the query in a newCompletionStage
that is asynchronously completed by a task running in the given executor.- Returns:
- A result value, depending on the concrete implementation of
Query
:
-
isExecutable
boolean isExecutable()Whether this query is executable in its current state.DML queries may be incomplete in structure and thus not executable. Calling
execute()
on such queries has no effect, but beware thatAttachableQueryPart.getSQL()
may not render valid SQL! -
bind
@NotNull @NotNull Query bind(String param, Object value) throws IllegalArgumentException, DataTypeException Bind a new value to a named parameter.[#1886] If the bind value with name
param
is inlined (Param.isInline()
) or if this query was created withStatementType.STATIC_STATEMENT
and there is an underlyingPreparedStatement
kept open because ofkeepStatement(boolean)
, the underlyingPreparedStatement
will be closed automatically in order for new bind values to have an effect.- Parameters:
param
- The named parameter name. If this is a number, then this is the same as callingbind(int, Object)
value
- The new bind value.- Throws:
IllegalArgumentException
- if there is no parameter by the given parameter name or index.DataTypeException
- ifvalue
cannot be converted into the parameter's data type
-
bind
@NotNull @NotNull Query bind(int index, Object value) throws IllegalArgumentException, DataTypeException Bind a new value to an indexed parameter.Bind index order
The 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 thevalue
and 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
DSL
method, 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
index
is inlined (Param.isInline()
) or if this query was created withStatementType.STATIC_STATEMENT
and there is an underlyingPreparedStatement
kept open because ofkeepStatement(boolean)
, the underlyingPreparedStatement
will be closed automatically in order for new bind values to have an effect.- Parameters:
index
- The parameter index in rendering order, starting with 1value
- The new bind value.- Throws:
IllegalArgumentException
- if there is no parameter by the given parameter index.DataTypeException
- ifvalue
cannot be converted into the parameter's data type
- Db2:
-
poolable
Specify whether any JDBCStatement
created 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.
- See Also:
-
queryTimeout
Specify the query timeout in number of seconds for the underlying JDBCStatement
.- See Also:
-
keepStatement
Keep the query's underlying statement open after execution.This indicates to jOOQ that the query's underlying
Statement
orPreparedStatement
should be kept open after execution. If it is kept open, client code is responsible for properly closing it usingCloseableQuery.close()
, e.g. via atry-with-resources
statement.- Parameters:
keepStatement
- Whether to keep the underlying statement open
-
cancel
Cancel the underlying statement.This cancels the query's underlying
Statement
orPreparedStatement
. If there is no underlying open and running statement, this call is simply ignored.- Throws:
DataAccessException
- If something went wrong cancelling the statement- See Also:
-