Top Fields Constructors Methods
org.jooq.impl

pack-priv abstract Class AbstractQuery<R extends org.jooq.Record>

extends AbstractAttachableQueryPart
implements CloseableQuery
Class Inheritance
All Implemented Interfaces
org.jooq.CloseableQuery, java.lang.AutoCloseable, org.jooq.Query, org.jooq.AttachableQueryPart, org.jooq.QueryPart, java.io.Serializable, org.jooq.Attachable, org.jooq.Statement
Known Direct Subclasses
org.jooq.impl.AbstractResultQuery, org.jooq.impl.AbstractRowCountQuery
Static Imports
java.lang.Boolean.TRUE, org.jooq.Constants.FULL_VERSION, .ExecuteType.DDL, .SQLDialect.FIREBIRD, .SQLDialect.HSQLDB, org.jooq.conf.ParamType.INLINED, .SettingsTools.executePreparedStatements, .SettingsTools.getParamType, .ThrowExceptions.THROW_NONE, org.jooq.impl.DSL.using, .Tools.EMPTY_PARAM, .Tools.blocking, .Tools.consumeExceptions, .Tools.BooleanDataKey.DATA_COUNT_BIND_VALUES, .Tools.BooleanDataKey.DATA_FORCE_STATIC_STATEMENT

Author
Lukas Eder

Field Summary

Modifier and TypeField and Description
private boolean
private static final JooqLogger
private QueryPoolable
pack-priv transient DefaultRenderContext.Rendered
private static final Set<SQLDialect>
pack-priv transient PreparedStatement
pack-priv transient int
private int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public CloseableQuery
bind(String
The named parameter name. If this is a number, then this is the same as calling bind(int, Object)
param
,
Object
The new bind value.
value
)

Implements org.jooq.CloseableQuery.bind.

Subclasses may override this for covariant result types

Bind a new value to a named parameter.

public CloseableQuery
bind(int
The parameter index, starting with 1
index
,
Object
The new bind value.
value
)

Implements org.jooq.CloseableQuery.bind.

Subclasses may override this for covariant result types

Bind a new value to an indexed parameter.

public final void
cancel()

Implements org.jooq.Query.cancel.

Cancel the underlying statement.
public final void
close()

Implements org.jooq.CloseableQuery.close.

Close the underlying statement.
private final void
closeIfNecessary(Param<?>
The param that was changed
param
)

Deprecated as a consequence of Param being deprecated.
Close the statement if necessary.
pack-priv static final Connection
public final int
execute()

Implements org.jooq.Query.execute.

Execute the query, if it has been created with a proper configuration.
protected int
execute(ExecuteContext ctx, ExecuteListener listener)

Default implementation for query execution using a prepared statement.

public final CompletionStage<Integer>
executeAsync()

Implements org.jooq.Query.executeAsync.

Execute the query in a new CompletionStage.
public final CompletionStage<Integer>
executeAsync(Executor executor)

Implements org.jooq.Query.executeAsync.

Execute the query in a new CompletionStage that is asynchronously completed by a task running in the given executor.
private static final DefaultRenderContext.Rendered
public boolean
isExecutable()

Implements org.jooq.Query.isExecutable.

Default implementation for executable check.
protected boolean
keepResultSet()

Default implementation to indicate whether this query should close the ResultSet after execution.

public CloseableQuery
keepStatement(boolean
Whether to keep the underlying statement open
k
)

Implements org.jooq.CloseableQuery.keepStatement.

Subclasses may override this for covariant result types

Keep the query's underlying statement open after execution.

protected final boolean
public CloseableQuery
poolable(boolean p)

Implements org.jooq.CloseableQuery.poolable.

Subclasses may override this for covariant result types

Specify whether any JDBC java.sql.Statement created by this query should be java.sql.Statement#setPoolable(boolean).

protected void
prepare(ExecuteContext ctx)

Default implementation for preparing a statement.

public CloseableQuery
queryTimeout(int t)

Implements org.jooq.CloseableQuery.queryTimeout.

Subclasses may override this for covariant result types

Specify the query timeout in number of seconds for the underlying JDBC Statement.

pack-priv final void
Inherited from org.jooq.impl.AbstractAttachableQueryPart:
attachconfigurationconfigurationOrDefaultconfigurationOrThrowdetachgetBindValuesgetParamgetParamsgetSQLgetSQL

Field Detail

keepStatementback to summary
private boolean keepStatement
logback to summary
private static final JooqLogger log

Hides org.jooq.impl.AbstractQueryPart.log.

poolableback to summary
private QueryPoolable poolable
renderedback to summary
pack-priv transient DefaultRenderContext.Rendered rendered
SET_AUTOCOMMIT_ON_START_TRANSACTIONback to summary
private static final Set<SQLDialect> SET_AUTOCOMMIT_ON_START_TRANSACTION
statementback to summary
pack-priv transient PreparedStatement statement
statementExecutionCountback to summary
pack-priv transient int statementExecutionCount
timeoutback to summary
private int timeout

Constructor Detail

AbstractQueryback to summary
pack-priv AbstractQuery(Configuration configuration)

Method Detail

bindback to summary
public CloseableQuery bind(String param, Object value)

Implements org.jooq.CloseableQuery.bind.

Doc from org.jooq.Query.bind.

Subclasses may override this for covariant result types

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 with StatementType#STATIC_STATEMENT and there is an underlying PreparedStatement kept open because of keepStatement(boolean), the underlying PreparedStatement will be closed automatically in order for new bind values to have an effect.

Parameters
param:String

The named parameter name. If this is a number, then this is the same as calling bind(int, Object)

value:Object

The new bind value.

Annotations
@Override
bindback to summary
public CloseableQuery bind(int index, Object value)

Implements org.jooq.CloseableQuery.bind.

Doc from org.jooq.Query.bind.

Subclasses may override this for covariant result types

Bind a new value to an indexed parameter.

[#1886] If the bind value at index is inlined ( Param#isInline()) or if this query was created with StatementType#STATIC_STATEMENT and there is an underlying PreparedStatement kept open because of keepStatement(boolean), the underlying PreparedStatement will be closed automatically in order for new bind values to have an effect.

Parameters
index:int

The parameter index, starting with 1

value:Object

The new bind value.

Annotations
@Override
cancelback to summary
public final void cancel()

Implements org.jooq.Query.cancel.

Doc from org.jooq.Query.cancel.

Cancel the underlying statement.

This cancels the query's underlying Statement or PreparedStatement. If there is no underlying open and running statement, this call is simply ignored.

Annotations
@Override
closeback to summary
public final void close()

Implements org.jooq.CloseableQuery.close.

Doc from org.jooq.CloseableQuery.close.

Close the underlying statement.

This closes the query's underlying Statement or PreparedStatement if a previous call to keepStatement(boolean) indicated that jOOQ should keep statements open after query execution. If there is no underlying open statement, this call is simply ignored.

Annotations
@Override
closeIfNecessaryback to summary
private final void closeIfNecessary(Param<?> param)

Deprecated

as a consequence of Param being deprecated. See corresponding docs for further information.

Close the statement if necessary.

[#1886] If there is an open (cached) statement and its bind values are inlined due to a StatementType#STATIC_STATEMENT setting, the statement should be closed.

Parameters
param:Param<?>

The param that was changed

connectionback to summary
pack-priv static final Connection connection(DefaultExecuteContext ctx)
executeback to summary
public final int execute()

Implements org.jooq.Query.execute.

Doc from org.jooq.Query.execute.

Execute the query, if it has been created with a proper configuration.

Returns:int

A result value, depending on the concrete implementation of Query:

  • Delete : the number of deleted records
  • Insert : the number of inserted records
  • Merge : the result may have no meaning
  • Select : the number of resulting records
  • Truncate : the result may have no meaning
  • Update : the number of updated records
Annotations
@Override
executeback to summary
protected int execute(ExecuteContext ctx, ExecuteListener listener) throws SQLException

Default implementation for query execution using a prepared statement. Subclasses may override this method.

executeAsyncback to summary
public final CompletionStage<Integer> executeAsync()

Implements org.jooq.Query.executeAsync.

Doc from org.jooq.Query.executeAsync.

Execute the query in a new CompletionStage.

The result is asynchronously completed by a task running in an Executor provided by the underlying Configuration#executorProvider().

Returns:CompletionStage<Integer>

A result value, depending on the concrete implementation of Query:

  • Delete : the number of deleted records
  • Insert : the number of inserted records
  • Merge : the result may have no meaning
  • Select : the number of resulting records
  • Truncate : the result may have no meaning
  • Update : the number of updated records
Annotations
@Override
executeAsyncback to summary
public final CompletionStage<Integer> executeAsync(Executor executor)

Implements org.jooq.Query.executeAsync.

Doc from org.jooq.Query.executeAsync.

Execute the query in a new CompletionStage that is asynchronously completed by a task running in the given executor.

Returns:CompletionStage<Integer>

A result value, depending on the concrete implementation of Query:

  • Delete : the number of deleted records
  • Insert : the number of inserted records
  • Merge : the result may have no meaning
  • Select : the number of resulting records
  • Truncate : the result may have no meaning
  • Update : the number of updated records
Annotations
@Override
getSQL0back to summary
private static final DefaultRenderContext.Rendered getSQL0(DefaultExecuteContext ctx)
isExecutableback to summary
public boolean isExecutable()

Implements org.jooq.Query.isExecutable.

Default implementation for executable check. Subclasses may override this method.

Annotations
@Override
keepResultSetback to summary
protected boolean keepResultSet()

Default implementation to indicate whether this query should close the ResultSet after execution. Subclasses may override this method.

keepStatementback to summary
public CloseableQuery keepStatement(boolean k)

Implements org.jooq.CloseableQuery.keepStatement.

Doc from org.jooq.Query.keepStatement.

Subclasses may override this for covariant result types

Keep the query's underlying statement open after execution.

This indicates to jOOQ that the query's underlying Statement or PreparedStatement should be kept open after execution. If it is kept open, client code is responsible for properly closing it using CloseableQuery#close(), e.g. via a try-with-resources statement.

Parameters
k:boolean

Whether to keep the underlying statement open

Annotations
@Override
keepStatementback to summary
protected final boolean keepStatement()
poolableback to summary
public CloseableQuery poolable(boolean p)

Implements org.jooq.CloseableQuery.poolable.

Doc from org.jooq.Query.poolable.

Subclasses may override this for covariant result types

Specify whether any JDBC java.sql.Statement created by this query should be java.sql.Statement#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.

Annotations
@Override
prepareback to summary
protected void prepare(ExecuteContext ctx) throws SQLException

Default implementation for preparing a statement. Subclasses may override this method.

queryTimeoutback to summary
public CloseableQuery queryTimeout(int t)

Implements org.jooq.CloseableQuery.queryTimeout.

Doc from org.jooq.Query.queryTimeout.

Subclasses may override this for covariant result types

Specify the query timeout in number of seconds for the underlying JDBC Statement.

Annotations
@Override
toSQLSemiColonback to summary
pack-priv final void toSQLSemiColon(RenderContext ctx)