public interface ExecuteContext
Query
execution passed to registered
ExecuteListener
's.ExecuteListener
Modifier and Type | Method and Description |
---|---|
Query[] |
batchQueries()
The jOOQ
Query objects that are being executed in batch mode, or
empty if the query is unknown or if there was no jOOQ Query . |
int[] |
batchRows()
The number of rows that were affected by the last statement executed in
batch mode.
|
String[] |
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.
|
Configuration |
configuration()
The configuration wrapped by this context.
|
Connection |
connection()
The connection to be used in this execute context.
|
void |
connectionProvider(ConnectionProvider connectionProvider)
Override the
Connection that is being used for execution. |
Map<Object,Object> |
data()
Get all custom data from this
ExecuteContext . |
Object |
data(Object key)
Get some custom data from this
ExecuteContext . |
Object |
data(Object key,
Object value)
Set some custom data to this
ExecuteContext . |
RuntimeException |
exception()
The
RuntimeException being thrown. |
void |
exception(RuntimeException e)
Override the
RuntimeException being thrown. |
Query |
query()
The jOOQ
Query that is being executed or null if the
query is unknown, if it is a batch query, or if there was no jOOQ
Query . |
Record |
record()
The last record that was fetched from the result set, or
null if no record has been fetched. |
void |
record(Record record)
Calling this has no effect.
|
Result<?> |
result()
The last result that was fetched from the result set, or
null if no result has been fetched. |
void |
result(Result<?> result)
Calling this has no effect.
|
ResultSet |
resultSet()
The
ResultSet that is being fetched or null if the
result set is unknown or if no result set is being fetched. |
void |
resultSet(ResultSet resultSet)
Override the
ResultSet that is being fetched. |
Routine<?> |
routine()
The jOOQ
Routine that is being executed or null if
the query is unknown or if there was no jOOQ Routine . |
int |
rows()
The number of rows that were affected by the last statement.
|
void |
rows(int rows)
Calling this has no effect.
|
String |
sql()
The SQL that is being executed or
null if the SQL statement
is unknown or if there was no SQL statement. |
void |
sql(String sql)
Override the SQL statement that is being executed.
|
SQLException |
sqlException()
The
SQLException that was thrown by the database. |
void |
sqlException(SQLException e)
Override the
SQLException being thrown. |
PreparedStatement |
statement()
The
PreparedStatement that is being executed or null
if the statement is unknown or if there was no statement. |
void |
statement(PreparedStatement statement)
Override the
PreparedStatement that is being executed. |
ExecuteType |
type()
The type of database interaction that is being executed.
|
Map<Object,Object> data()
ExecuteContext
.
This is custom data that was previously set to the execute context using
data(Object, Object)
. Use custom data if you want to pass data
between events received by an ExecuteListener
.
Unlike Configuration.data()
, these data's lifecycle only
matches that of a single query execution.
null
ExecuteListener
Object data(Object key)
ExecuteContext
.
This is custom data that was previously set to the execute context using
data(Object, Object)
. Use custom data if you want to pass
data between events received by an ExecuteListener
.
Unlike Configuration.data()
, these data's lifecycle only
matches that of a single query execution.
key
- A key to identify the custom datanull
if no such data is contained
in this ExecuteContext
ExecuteListener
Object data(Object key, Object value)
ExecuteContext
.
This is custom data that was previously set to the execute context using
data(Object, Object)
. Use custom data if you want to pass
data between events received by an ExecuteListener
.
Unlike Configuration.data()
, these data's lifecycle only
matches that of a single query execution.
key
- A key to identify the custom datavalue
- The custom datanull
if no data
was previously set for the given keyExecuteListener
Configuration configuration()
Connection connection()
This returns a proxy to the Configuration.connectionProvider()
's supplied connection. This proxy takes care of two things:
Settings.getStatementType()
ConnectionProvider.release(Connection)
, once jOOQ can release the
connectionExecuteType type()
ExecuteType
Query query()
Query
that is being executed or null
if the
query is unknown, if it is a batch query, or if there was no jOOQ
Query
.routine()
,
batchQueries()
Query[] batchQueries()
Query
objects that are being executed in batch mode, or
empty if the query is unknown or if there was no jOOQ Query
.
If a single Query
is executed in non-batch mode, this will
return an array of length 1
, containing that
Query
Routine<?> routine()
Routine
that is being executed or null
if
the query is unknown or if there was no jOOQ Routine
.routine()
String sql()
null
if the SQL statement
is unknown or if there was no SQL statement.void sql(String sql)
This may have no effect, if called at the wrong moment.
String[] batchSQL()
If a single Query
is executed in non-batch mode, this will
return an array of length 1
, containing that
Query
void connectionProvider(ConnectionProvider connectionProvider)
Connection
that is being used for execution.
This may have no effect, if called at the wrong moment.
ExecuteListener.start(ExecuteContext)
PreparedStatement statement()
PreparedStatement
that is being executed or null
if the statement is unknown or if there was no statement.
This can be any of the following:
java.sql.PreparedStatement
from your JDBC driver when
a jOOQ Query
is being executed as
StatementType.PREPARED_STATEMENT
java.sql.Statement
from your JDBC driver wrapped in a
java.sql.PreparedStatement
when your jOOQ Query
is being executed as StatementType.STATIC_STATEMENT
java.sql.CallableStatement
when you are executing a
jOOQ Routine
void statement(PreparedStatement statement)
PreparedStatement
that is being executed.
This may have no effect, if called at the wrong moment.
ResultSet resultSet()
ResultSet
that is being fetched or null
if the
result set is unknown or if no result set is being fetched.void resultSet(ResultSet resultSet)
ResultSet
that is being fetched.
This may have no effect, if called at the wrong moment.
Record record()
null
if no record has been fetched.void record(Record record)
int rows()
This returns -1
if the number of affected rows is not yet
available, or if affected rows are not applicable for the given
statement.
void rows(int rows)
int[] batchRows()
If a single Query
is executed in non-batch mode, this will
return an array of length 1
, containing rows()
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.
null
rows()
Result<?> result()
null
if no result has been fetched.void result(Result<?> result)
RuntimeException exception()
RuntimeException
being thrown.void exception(RuntimeException e)
RuntimeException
being thrown.
This may have no effect, if called at the wrong moment.
SQLException sqlException()
SQLException
that was thrown by the database.void sqlException(SQLException e)
SQLException
being thrown.
Any SQLException
will be wrapped by jOOQ using an unchecked
DataAccessException
. To have jOOQ throw your own custom
RuntimeException
, use exception(RuntimeException)
instead. This may have no effect, if called at the wrong moment.
Copyright © 2014. All Rights Reserved.