- All Superinterfaces:
Scope
Query
execution passed to registered
ExecuteListener
's.
This type implements Scope
and thus has a lifecycle defined by the
query execution.
The Scope.data()
map contents are maintained for the entirety of the
execution, and are passed along to child Scope
types, including e.g.
BindingScope
: When passing bind values or reading results.
- Author:
- Lukas Eder
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
The batch mode, which helps interpret the contents ofbatchQueries()
. -
Method Summary
Modifier and TypeMethodDescription@NotNull ExecuteContext.BatchMode
The batch execution mode.@NotNull Query @NotNull []
The jOOQQuery
objects that are being executed in batch mode, or empty if the query is unknown or if there was no jOOQQuery
.void
batchQueries
(Query... query) Set the jOOQ batchQuery
objects that are being executed, if applicable.int @NotNull []
The number of rows that were affected by the last statement executed in batch mode.@NotNull String @NotNull []
batchSQL()
The generated SQL statements that are being executed in batch mode, or empty if the query is unknown or if there was no SQL statement.The connection to be used in this execute context.void
connectionProvider
(ConnectionProvider connectionProvider) Override theConnection
that is being used for execution.Get aConverterContext
for the scope of thisExecuteContext
.@Nullable RuntimeException
TheRuntimeException
being thrown.void
Override theRuntimeException
being thrown.@NotNull Query @NotNull []
The original batchQuery
objects that were available at theExecuteListener.start(ExecuteContext)
of thisExecuteContext
.@Nullable Query
The originalQuery
that was available at theExecuteListener.start(ExecuteContext)
of thisExecuteContext
, ornull
if the query is unknown, if it is a batch query, or if there was no jOOQQuery
.Param<?> @NotNull []
params()
The bind values that are being bound to thePreparedStatement
.void
Override the bind values that are being bound to thePreparedStatement
.@Nullable Query
query()
The jOOQQuery
that is being executed, ornull
if the query is unknown, if it is a batch query, or if there was no jOOQQuery
.void
Set the jOOQQuery
that is being executed, if applicable.@Nullable Record
record()
The last record that was fetched from the result set, ornull
if no record has been fetched.void
Calling this has no effect.int
The 0-based record nesting level forrecord()
, relevant when nested result events are triggered viaExecuteListener.resultStart(ExecuteContext)
andExecuteListener.resultEnd(ExecuteContext)
, e.g.@Nullable Result
<?> result()
The last result that was fetched from the result set, ornull
if no result has been fetched, including when results do not need to be buffered in aResult
type, such as allResultQuery.collect(Collector)
orResultQuery.iterator()
based fetches.void
Calling this has no effect.int
The 0-based result nesting level forresult()
, relevant when nested result events are triggered viaExecuteListener.resultStart(ExecuteContext)
andExecuteListener.resultEnd(ExecuteContext)
, e.g.@Nullable ResultSet
TheResultSet
that is being fetched ornull
if the result set is unknown or if no result set is being fetched.void
Override theResultSet
that is being fetched.@Nullable Routine
<?> routine()
The jOOQRoutine
that is being executed ornull
if the query is unknown or if there was no jOOQRoutine
.int
rows()
The number of rows that were affected by the last statement.void
rows
(int rows) Calling this has no effect.@NotNull String @NotNull []
Any server output collected from this statement when
.Settings.getFetchServerOutputSize()
> 0void
serverOutput
(String[] output) Any server output collected from this statement when
.Settings.getFetchServerOutputSize()
> 0int
The number of user defined update counts that are going to be skipped when a statement batch is executed.void
skipUpdateCounts
(int skip) Override the number of update counts that are going to be skipped when a statement batch is executed.@Nullable String
sql()
The SQL that is being executed ornull
if the SQL statement is unknown or if there was no SQL statement.void
Override the SQL statement that is being executed.@Nullable SQLException
TheSQLException
that was thrown by the database.void
Override theSQLException
being thrown.@Nullable SQLWarning
TheSQLWarning
that was emitted by the database.void
Override theSQLWarning
being emitted.@Nullable PreparedStatement
ThePreparedStatement
that is being executed ornull
if the statement is unknown or if there was no statement.void
statement
(PreparedStatement statement) Override thePreparedStatement
that is being executed.int
The number of times this particular statement has been executed.@NotNull Query @NotNull []
The transformed batchQuery
objects that were available at theExecuteListener.transformEnd(ExecuteContext)
event of thisExecuteContext
.@Nullable Query
The transformedQuery
that was available at theExecuteListener.transformEnd(ExecuteContext)
event of thisExecuteContext
, ornull
if the query is unknown, if it is a batch query, or if there was no jOOQQuery
.@NotNull ExecuteType
type()
The type of database interaction that is being executed.Methods inherited from interface org.jooq.Scope
configuration, creationTime, data, data, data, dialect, dsl, family, settings
-
Method Details
-
converterContext
ConverterContext converterContext()Get aConverterContext
for the scope of thisExecuteContext
. -
connection
Connection connection()The connection to be used in this execute context.This returns a proxy to the
Configuration.connectionProvider()
's supplied connection. This proxy takes care of two things:- It takes care of properly implementing
Settings.getStatementType()
- It takes care of properly returning a connection to
ConnectionProvider.release(Connection)
, once jOOQ can release the connection
- It takes care of properly implementing
-
type
The type of database interaction that is being executed.- See Also:
-
query
The jOOQQuery
that is being executed, ornull
if the query is unknown, if it is a batch query, or if there was no jOOQQuery
.This corresponds to
transformedQuery()
.- See Also:
-
originalQuery
The originalQuery
that was available at theExecuteListener.start(ExecuteContext)
of thisExecuteContext
, ornull
if the query is unknown, if it is a batch query, or if there was no jOOQQuery
. -
transformedQuery
The transformedQuery
that was available at theExecuteListener.transformEnd(ExecuteContext)
event of thisExecuteContext
, ornull
if the query is unknown, if it is a batch query, or if there was no jOOQQuery
.If no transformation took place (yet), then this is the same as
originalQuery()
. -
query
Set the jOOQQuery
that is being executed, if applicable.This may have no effect, if called at the wrong moment, or if
batchMode()
is notExecuteContext.BatchMode.NONE
.- See Also:
-
batchMode
The batch execution mode. -
batchQueries
The jOOQQuery
objects that are being executed in batch mode, or empty if the query is unknown or if there was no jOOQQuery
.If a single
Query
is executed in non-batch mode, this will return an array of length1
, containing thatQuery
Refer to
batchMode()
to decide how to interpret this content.This corresponds to
transformedBatchQueries()
.- Returns:
- The executed
Query
object(s). This is nevernull
- See Also:
-
originalBatchQueries
The original batchQuery
objects that were available at theExecuteListener.start(ExecuteContext)
of thisExecuteContext
. -
transformedBatchQueries
The transformed batchQuery
objects that were available at theExecuteListener.transformEnd(ExecuteContext)
event of thisExecuteContext
.If no transformation took place (yet), then this is the same as
originalBatchQueries()
. -
batchQueries
Set the jOOQ batchQuery
objects that are being executed, if applicable.This may have no effect, if called at the wrong moment, or if
batchMode()
isExecuteContext.BatchMode.NONE
.- See Also:
-
routine
The jOOQRoutine
that is being executed ornull
if the query is unknown or if there was no jOOQRoutine
.- See Also:
-
sql
The SQL that is being executed ornull
if the SQL statement is unknown or if there was no SQL statement. -
sql
Override the SQL statement that is being executed.This may have no effect, if called at the wrong moment.
- See Also:
-
params
Param<?> @NotNull [] params()The bind values that are being bound to thePreparedStatement
. -
params
Override the bind values that are being bound to thePreparedStatement
.This may have no effect, if called at the wrong moment.
- See Also:
-
skipUpdateCounts
int skipUpdateCounts()The number of user defined update counts that are going to be skipped when a statement batch is executed.This is in addition to any skips added during the rendering of a
QueryPart
by jOOQ's internals or by user-defined query parts, such asCustomQueryPart
. -
skipUpdateCounts
void skipUpdateCounts(int skip) Override the number of update counts that are going to be skipped when a statement batch is executed.This is in addition to any skips added during the rendering of a
QueryPart
by jOOQ's internals or by user-defined query parts, such asCustomQueryPart
.This may have no effect, if called at the wrong moment.
- See Also:
-
batchSQL
The generated SQL statements that are being executed in batch mode, or empty if the query is unknown or if there was no SQL statement.If a single
Query
is executed in non-batch mode, this will return an array of length1
, containing thatQuery
- Returns:
- The generated SQL statement(s). This is never
null
- See Also:
-
connectionProvider
Override theConnection
that is being used for execution.This may have no effect, if called at the wrong moment.
- See Also:
-
statement
ThePreparedStatement
that is being executed ornull
if the statement is unknown or if there was no statement.This can be any of the following:
- A
java.sql.PreparedStatement
from your JDBC driver when a jOOQQuery
is being executed asStatementType.PREPARED_STATEMENT
- A
java.sql.Statement
from your JDBC driver wrapped in ajava.sql.PreparedStatement
when your jOOQQuery
is being executed asStatementType.STATIC_STATEMENT
- A
java.sql.CallableStatement
when you are executing a jOOQRoutine
- A
-
statement
Override thePreparedStatement
that is being executed.This may have no effect, if called at the wrong moment.
- See Also:
-
statementExecutionCount
int statementExecutionCount()The number of times this particular statement has been executed.Statements that are prepared by jOOQ can be executed multiple times without being closed if
Query.keepStatement(boolean)
is activated.This value will increment as soon as the statement is about to be executed (at the
ExecuteListener.executeStart(ExecuteContext)
event).- See Also:
-
resultSet
TheResultSet
that is being fetched ornull
if the result set is unknown or if no result set is being fetched. -
resultSet
Override theResultSet
that is being fetched.This may have no effect, if called at the wrong moment.
- See Also:
-
recordLevel
int recordLevel()The 0-based record nesting level forrecord()
, relevant when nested result events are triggered viaExecuteListener.resultStart(ExecuteContext)
andExecuteListener.resultEnd(ExecuteContext)
, e.g. in the presence ofDSL.multiset(TableLike)
. -
record
The last record that was fetched from the result set, ornull
if no record has been fetched. -
record
Calling this has no effect. It is used by jOOQ internally. -
rows
int rows()The number of rows that were affected by the last statement.This returns
-1
:- if the number of affected rows is not yet available (e.g. prior to
the
ExecuteListener.executeEnd(ExecuteContext)
event). - if affected rows are not applicable for the given statement
(statements that do not produce a JDBC
Statement.getUpdateCount()
.
- if the number of affected rows is not yet available (e.g. prior to
the
-
rows
void rows(int rows) Calling this has no effect. It is used by jOOQ internally. -
batchRows
int @NotNull [] batchRows()The number of rows that were affected by the last statement executed in batch mode.If a single
Query
is executed in non-batch mode, this will return an array of length1
, containingrows()
This returns
-1
values if the number of affected rows is not yet available, or if affected rows are not applicable for a given statement.- Returns:
- The affected rows. This is never
null
- See Also:
-
resultLevel
int resultLevel()The 0-based result nesting level forresult()
, relevant when nested result events are triggered viaExecuteListener.resultStart(ExecuteContext)
andExecuteListener.resultEnd(ExecuteContext)
, e.g. in the presence ofDSL.multiset(TableLike)
. -
result
The last result that was fetched from the result set, ornull
if no result has been fetched, including when results do not need to be buffered in aResult
type, such as allResultQuery.collect(Collector)
orResultQuery.iterator()
based fetches. -
result
Calling this has no effect. It is used by jOOQ internally. -
exception
TheRuntimeException
being thrown. -
exception
Override theRuntimeException
being thrown.This may have no effect, if called at the wrong moment.
If
null
is being passed, jOOQ will internally translate the "unavailable" exception to an unspecifiedDataAccessException
. -
sqlException
TheSQLException
that was thrown by the database. -
sqlException
Override theSQLException
being thrown.Any
SQLException
will be wrapped by jOOQ using an uncheckedDataAccessException
. To have jOOQ throw your own customRuntimeException
, useexception(RuntimeException)
instead. This may have no effect, if called at the wrong moment.If
null
is being passed, jOOQ will internally translate the "unavailable" exception to an unspecifiedDataAccessException
. -
sqlWarning
TheSQLWarning
that was emitted by the database.Note that fetching of warnings can be disabled using
Settings.isFetchWarnings()
, in case of which this property will benull
. -
sqlWarning
Override theSQLWarning
being emitted. -
serverOutput
Any server output collected from this statement when
.Settings.getFetchServerOutputSize()
> 0- Returns:
- The server output. This is never
null
.
-
serverOutput
Any server output collected from this statement when
.Settings.getFetchServerOutputSize()
> 0
-