/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Other licenses:
 * -----------------------------------------------------------------------------
 * Commercial licenses for this work are available. These replace the above
 * ASL 2.0 and offer limited warranties, support, maintenance, and commercial
 * database integrations.
 *
 * For more information, please visit: http://www.jooq.org/licenses
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */
package org.jooq;

import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.util.EventListener;

import org.jooq.conf.Settings;
import org.jooq.conf.StatementType;
import org.jooq.impl.DSL;
import org.jooq.impl.DefaultExecuteListener;
import org.jooq.tools.LoggerListener;

An event listener for Query, Routine, or ResultSet render, prepare, bind, execute, fetch steps.

ExecuteListener is a base type for loggers, debuggers, profilers, data collectors that can be hooked into a jOOQ DSLContext using the Configuration.executeListenerProviders() property, passing Settings to DSL.using(Connection, SQLDialect, Settings). jOOQ will use that configuration at the beginning of a query execution event to instantiate all the provided listeners. In other words, listeners have the same lifetime as a single query execution, and can thus be used to store state between the moment when a query execution starts, and the moment when a query execution finishes. Advanced ExecuteListeners can also provide custom implementations of Connection, PreparedStatement, ResultSet, SQLException or RuntimeException to jOOQ in appropriate methods.

For convenience, consider extending DefaultExecuteListener instead of implementing this interface. This will prevent compilation errors in future versions of jOOQ, when this interface might get new methods.

The following table explains how every type of statement / operation invokes callback methods in the correct order for all registered ExecuteListeners. Find a legend below the table for the various use cases.

Callback method Use case [1] Use case [2] Use case [3] Use case [4] Use case [5] Use case [6]
start(ExecuteContext) Yes, 1x Yes, 1x Yes, 1x Yes, 1x Yes, 1x Yes, 1x
renderStart(ExecuteContext) Yes, 1x Yes, 1x No Yes, 1x Yes, Nx (for every query) Yes, 1x
renderEnd(ExecuteContext) Yes, 1x Yes, 1x No Yes, 1x Yes, Nx (for every query) Yes, 1x
prepareStart(ExecuteContext) Yes, 1x Yes, 1x No Yes, 1x Yes, Nx (for every query) Yes, 1x
prepareEnd(ExecuteContext) Yes, 1x Yes, 1x No Yes, 1x Yes, Nx (for every query) Yes, 1x
bindStart(ExecuteContext) Yes, 1x No No Yes, Nx (for every value set) No Yes, 1x
bindEnd(ExecuteContext) Yes, 1x No No Yes, Nx (for every value set) No Yes, 1
executeStart(ExecuteContext) Yes, 1x Yes, 1x No Yes, 1x Yes, 1x Yes, 1x
executeEnd(ExecuteContext) Yes, 1x Yes, 1x No Yes, 1x Yes, 1x Yes, 1x
outStart(ExecuteContext) No No No No No Yes, 1x
outEnd(ExecuteContext) No No No No No Yes, 1x
fetchStart(ExecuteContext) Yes, 1x (Nx for ResultQuery.fetchMany() Yes, 1x (Nx for ResultQuery.fetchMany() Yes, 1x No No No
resultStart(ExecuteContext) Yes, 1x (Nx for Cursor.fetchNext(int) Yes, 1x (Nx for Cursor.fetchNext(int) Yes, 1x No No No
recordStart(ExecuteContext)
Yes, Nx Yes, Nx Yes, Nx No No No
recordEnd(ExecuteContext) Yes, Nx Yes, Nx Yes, Nx No No No
resultEnd(ExecuteContext) Yes, 1x (Nx for Cursor.fetchNext(int) Yes, 1x (Nx for Cursor.fetchNext(int) Yes, 1x No No No
fetchEnd(ExecuteContext) Yes, 1x (Nx for ResultQuery.fetchMany() Yes, 1x (Nx for ResultQuery.fetchMany() Yes, 1x No No No
end(ExecuteContext) Yes, 1x Yes, 1x Yes, 1x Yes, 1x Yes, 1x Yes, 1x
warning(ExecuteContext) Maybe, 1x Maybe, 1x Maybe, 1x Maybe, 1x Maybe, 1x Maybe, 1x
exception(ExecuteContext) Maybe, 1x Maybe, 1x Maybe, 1x Maybe, 1x Maybe, 1x Maybe, 1x

Legend:

  1. Used with ResultQuery of statement type StatementType.PREPARED_STATEMENT
  2. Used with ResultQuery of statement type StatementType.STATIC_STATEMENT
  3. Used with DSLContext.fetch(ResultSet) or with InsertResultStep.fetch()
  4. Used with DSLContext.batch(Query)
  5. Used with DSLContext.batch(Query[])
  6. Used with DSLContext.batch(Queries)
  7. Used with a Routine standalone call

If nothing is specified, the default is to use LoggerListener as the only event listener, as configured in Settings.isExecuteLogging()

Author:Lukas Eder
/** * An event listener for {@link Query}, {@link Routine}, or {@link ResultSet} * render, prepare, bind, execute, fetch steps. * <p> * <code>ExecuteListener</code> is a base type for loggers, debuggers, * profilers, data collectors that can be hooked into a jOOQ {@link DSLContext} * using the {@link Configuration#executeListenerProviders()} property, passing * <code>Settings</code> to * {@link DSL#using(java.sql.Connection, SQLDialect, Settings)}. jOOQ will use * that configuration at the beginning of a query execution event to instantiate * all the provided listeners. In other words, listeners have the same lifetime * as a single query execution, and can thus be used to store state between the * moment when a query execution starts, and the moment when a query execution * finishes. Advanced <code>ExecuteListeners</code> can also provide custom * implementations of {@link Connection}, {@link PreparedStatement}, * {@link ResultSet}, {@link SQLException} or {@link RuntimeException} to jOOQ * in appropriate methods. * <p> * For convenience, consider extending {@link DefaultExecuteListener} instead of * implementing this interface. This will prevent compilation errors in future * versions of jOOQ, when this interface might get new methods. * <p> * The following table explains how every type of statement / operation invokes * callback methods in the correct order for all registered * <code>ExecuteListeners</code>. Find a legend below the table for the various * use cases. * <table border="1"> * <tr> * <th>Callback method</th> * <th>Use case [1]</th> * <th>Use case [2]</th> * <th>Use case [3]</th> * <th>Use case [4]</th> * <th>Use case [5]</th> * <th>Use case [6]</th> * </tr> * <tr> * <td>{@link #start(ExecuteContext)}</code></td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * </tr> * <tr> * <td>{@link #renderStart(ExecuteContext)}</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>No</td> * <td>Yes, 1x</td> * <td>Yes, Nx (for every query)</td> * <td>Yes, 1x</td> * </tr> * <tr> * <td>{@link #renderEnd(ExecuteContext)}</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>No</td> * <td>Yes, 1x</td> * <td>Yes, Nx (for every query)</td> * <td>Yes, 1x</td> * </tr> * <tr> * <td>{@link #prepareStart(ExecuteContext)}</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>No</td> * <td>Yes, 1x</td> * <td>Yes, Nx (for every query)</td> * <td>Yes, 1x</td> * </tr> * <tr> * <td>{@link #prepareEnd(ExecuteContext)}</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>No</td> * <td>Yes, 1x</td> * <td>Yes, Nx (for every query)</td> * <td>Yes, 1x</td> * </tr> * <tr> * <td>{@link #bindStart(ExecuteContext)}</td> * <td>Yes, 1x</td> * <td>No</td> * <td>No</td> * <td>Yes, Nx (for every value set)</td> * <td>No</td> * <td>Yes, 1x</td> * </tr> * <tr> * <td>{@link #bindEnd(ExecuteContext)}</td> * <td>Yes, 1x</td> * <td>No</td> * <td>No</td> * <td>Yes, Nx (for every value set)</td> * <td>No</td> * <td>Yes, 1 * <tr> * <td>{@link #executeStart(ExecuteContext)}</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>No</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * </tr> * <tr> * <td>{@link #executeEnd(ExecuteContext)}</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>No</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * </tr> * <tr> * <td>{@link #outStart(ExecuteContext)}</td> * <td>No</td> * <td>No</td> * <td>No</td> * <td>No</td> * <td>No</td> * <td>Yes, 1x</td> * </tr> * <tr> * <td>{@link #outEnd(ExecuteContext)}</td> * <td>No</td> * <td>No</td> * <td>No</td> * <td>No</td> * <td>No</td> * <td>Yes, 1x</td> * </tr> * <tr> * <td>{@link #fetchStart(ExecuteContext)}</td> * <td>Yes, 1x (Nx for {@link ResultQuery#fetchMany()}</td> * <td>Yes, 1x (Nx for {@link ResultQuery#fetchMany()}</td> * <td>Yes, 1x</td> * <td>No</td> * <td>No</td> * <td>No</td> * </tr> * <tr> * <td>{@link #resultStart(ExecuteContext)}</td> * <td>Yes, 1x (Nx for {@link Cursor#fetchNext(int)}</td> * <td>Yes, 1x (Nx for {@link Cursor#fetchNext(int)}</td> * <td>Yes, 1x</td> * <td>No</td> * <td>No</td> * <td>No</td> * </tr> * <tr> * <td>{@link #recordStart(ExecuteContext)}<br/> * </td> * <td>Yes, Nx</td> * <td>Yes, Nx</td> * <td>Yes, Nx</td> * <td>No</td> * <td>No</td> * <td>No</td> * </tr> * <tr> * <td>{@link #recordEnd(ExecuteContext)}</td> * <td>Yes, Nx</td> * <td>Yes, Nx</td> * <td>Yes, Nx</td> * <td>No</td> * <td>No</td> * <td>No</td> * </tr> * <tr> * <td>{@link #resultEnd(ExecuteContext)}</td> * <td>Yes, 1x (Nx for {@link Cursor#fetchNext(int)}</td> * <td>Yes, 1x (Nx for {@link Cursor#fetchNext(int)}</td> * <td>Yes, 1x</td> * <td>No</td> * <td>No</td> * <td>No</td> * </tr> * <tr> * <td>{@link #fetchEnd(ExecuteContext)}</td> * <td>Yes, 1x (Nx for {@link ResultQuery#fetchMany()}</td> * <td>Yes, 1x (Nx for {@link ResultQuery#fetchMany()}</td> * <td>Yes, 1x</td> * <td>No</td> * <td>No</td> * <td>No</td> * </tr> * <tr> * <td>{@link #end(ExecuteContext)}</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * <td>Yes, 1x</td> * </tr> * <tr> * <td>{@link #warning(ExecuteContext)}</td> * <td>Maybe, 1x</td> * <td>Maybe, 1x</td> * <td>Maybe, 1x</td> * <td>Maybe, 1x</td> * <td>Maybe, 1x</td> * <td>Maybe, 1x</td> * </tr> * <tr> * <td>{@link #exception(ExecuteContext)}</td> * <td>Maybe, 1x</td> * <td>Maybe, 1x</td> * <td>Maybe, 1x</td> * <td>Maybe, 1x</td> * <td>Maybe, 1x</td> * <td>Maybe, 1x</td> * </tr> * </table> * <br/> * <p> * <h5>Legend:</h5> * <p> * <ol> * <li>Used with {@link ResultQuery} of statement type * {@link StatementType#PREPARED_STATEMENT}</li> * <li>Used with {@link ResultQuery} of statement type * {@link StatementType#STATIC_STATEMENT}</li> * <li>Used with {@link DSLContext#fetch(ResultSet)} or with * {@link InsertResultStep#fetch()}</li> * <li>Used with {@link DSLContext#batch(Query)}</li> * <li>Used with {@link DSLContext#batch(Query[])}</li> * <li>Used with {@link DSLContext#batch(Queries)}</li> * <li>Used with a {@link Routine} standalone call</li> * </ol> * <p> * If nothing is specified, the default is to use {@link LoggerListener} as the * only event listener, as configured in {@link Settings#isExecuteLogging()} * * @author Lukas Eder */
public interface ExecuteListener extends EventListener, Serializable {
Called to initialise an ExecuteListener.

Available attributes from ExecuteContext:

Overridable attributes in ExecuteContext:
/** * Called to initialise an <code>ExecuteListener</code>. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * </ul> * Overridable attributes in <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connectionProvider(ConnectionProvider)}: The * connection provider used for execution. This may be particularly * interesting if a {@link Query} was de-serialised and is thus lacking the * underlying connection</li> * </ul> */
void start(ExecuteContext ctx);
Called before rendering SQL from a QueryPart.

Available attributes from ExecuteContext:

/** * Called before rendering SQL from a <code>QueryPart</code>. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * </ul> */
void renderStart(ExecuteContext ctx);
Called after rendering SQL from a QueryPart.

Available attributes from ExecuteContext:

Overridable attributes in ExecuteContext:

/** * Called after rendering SQL from a <code>QueryPart</code>. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * </ul> * <p> * Overridable attributes in <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#sql(String)}: The rendered <code>SQL</code> * statement that is about to be executed. You can modify this statement * freely.</li> * </ul> */
void renderEnd(ExecuteContext ctx);
Called before preparing / creating the SQL statement.

Available attributes from ExecuteContext:

Overridable attributes in ExecuteContext:

/** * Called before preparing / creating the SQL statement. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * </ul> * <p> * Overridable attributes in <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#sql(String)}: The rendered <code>SQL</code> * statement that is about to be executed. You can modify this statement * freely.</li> * <li>{@link ExecuteContext#statement()}: The {@link PreparedStatement} * about to be executed. At this stage, no such statement is available yet, * but if provided, the execution lifecycle will skip preparing a statement. * This can be used e.g. to implement a transaction-bound prepared statement * cache. * <p> * A custom {@link PreparedStatement} needs to take into account * {@link Settings#getStatementType()}, and avoid bind variable markers for * {@link StatementType#STATIC_STATEMENT}. * <p> * Flags such as {@link Query#queryTimeout(int)}, * {@link Query#poolable(boolean)}, {@link ResultQuery#maxRows(int)}, which * correspond to mutable flags on a {@link PreparedStatement}, are set by * jOOQ even if a listener provides the statement. * <p> * Flags such as {@link ResultQuery#resultSetConcurrency(int)}, * {@link ResultQuery#resultSetHoldability(int)}, * {@link ResultQuery#resultSetType(int)}, which correspond to immutable * flags that are set on the statement at statement creation are not set on * a statement provided by a listener.</li> * </ul> */
void prepareStart(ExecuteContext ctx);
Called after preparing / creating the SQL statement.

Available attributes from ExecuteContext:

Overridable attributes in ExecuteContext:

/** * Called after preparing / creating the SQL statement. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.PreparedStatement</code> from your JDBC driver when * a jOOQ <code>Query</code> is being executed as * {@link StatementType#PREPARED_STATEMENT}</li> * <li>A <code>java.sql.Statement</code> from your JDBC driver wrapped in a * <code>java.sql.PreparedStatement</code> when your jOOQ <code>Query</code> * is being executed as {@link StatementType#STATIC_STATEMENT}</li> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * </li> * </ul> * <p> * Overridable attributes in <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#statement(PreparedStatement)}: The * <code>Statement</code>, <code>PreparedStatement</code>, or * <code>CallableStatement</code> that is about to be executed. You can * modify this statement freely, or wrap {@link ExecuteContext#statement()} * with your enriched statement wrapper</li> * </ul> */
void prepareEnd(ExecuteContext ctx);
Called before bind variables to the PreparedStatement.

Available attributes from ExecuteContext:

Overridable attributes in ExecuteContext:

Note that this method is not called when executing queries of type StatementType.STATIC_STATEMENT

/** * Called before bind variables to the <code>PreparedStatement</code>. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.PreparedStatement</code> from your JDBC driver when * a jOOQ <code>Query</code> is being executed as * {@link StatementType#PREPARED_STATEMENT}</li> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * </li> * </ul> * <p> * Overridable attributes in <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#statement(PreparedStatement)}: The * <code>PreparedStatement</code>, or <code>CallableStatement</code> that is * about to be executed. You can modify this statement freely, or wrap * {@link ExecuteContext#statement()} with your enriched statement * wrapper</li> * </ul> * <p> * Note that this method is not called when executing queries of type * {@link StatementType#STATIC_STATEMENT} */
void bindStart(ExecuteContext ctx);
Called after bind variables to the PreparedStatement.

Available attributes from ExecuteContext:

Overridable attributes in ExecuteContext:

Note that this method is not called when executing queries of type StatementType.STATIC_STATEMENT

/** * Called after bind variables to the <code>PreparedStatement</code>. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.PreparedStatement</code> from your JDBC driver when * a jOOQ <code>Query</code> is being executed as * {@link StatementType#PREPARED_STATEMENT}</li> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * </li> * </ul> * <p> * Overridable attributes in <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#statement(PreparedStatement)}: The * <code>Statement</code>, <code>PreparedStatement</code>, or * <code>CallableStatement</code> that is about to be executed. You can * modify this statement freely, or wrap {@link ExecuteContext#statement()} * with your enriched statement wrapper</li> * </ul> * <p> * Note that this method is not called when executing queries of type * {@link StatementType#STATIC_STATEMENT} */
void bindEnd(ExecuteContext ctx);
Called before executing a statement.

Available attributes from ExecuteContext:

Overridable attributes in ExecuteContext:

Other attributes in ExecuteContext, affected by this lifecycle phase:

/** * Called before executing a statement. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.PreparedStatement</code> from your JDBC driver when * a jOOQ <code>Query</code> is being executed as * {@link StatementType#PREPARED_STATEMENT}</li> * <li>A <code>java.sql.Statement</code> from your JDBC driver wrapped in a * <code>java.sql.PreparedStatement</code> when your jOOQ <code>Query</code> * is being executed as {@link StatementType#STATIC_STATEMENT}</li> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * </li> * </ul> * <p> * Overridable attributes in <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#statement(PreparedStatement)}: The * <code>Statement</code>, <code>PreparedStatement</code>, or * <code>CallableStatement</code> that is about to be executed. You can * modify this statement freely, or wrap {@link ExecuteContext#statement()} * with your enriched statement wrapper</li> * </ul> * <p> * Other attributes in <code>ExecuteContext</code>, affected by this * lifecycle phase: * <ul> * <li>{@link ExecuteContext#statementExecutionCount()} is incremented.</li> * </ul> */
void executeStart(ExecuteContext ctx);
Called after executing a statement.

Available attributes from ExecuteContext:

Overridable attributes in ExecuteContext:

/** * Called after executing a statement. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.PreparedStatement</code> from your JDBC driver when * a jOOQ <code>Query</code> is being executed as * {@link StatementType#PREPARED_STATEMENT}</li> * <li>A <code>java.sql.Statement</code> from your JDBC driver wrapped in a * <code>java.sql.PreparedStatement</code> when your jOOQ <code>Query</code> * is being executed as {@link StatementType#STATIC_STATEMENT}</li> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * </li> * <li>{@link ExecuteContext#resultSet()}: The <code>ResultSet</code> that * is about to be fetched or <code>null</code>, if the <code>Query</code> * returns no result set, or if a <code>Routine</code> is being * executed.</li> * <li>{@link ExecuteContext#rows()}: The number of affected rows if * applicable. In case a {@link ResultSet} is fetched, this number is only * available at the {@link #fetchEnd(ExecuteContext)} event.</li> * <li>{@link ExecuteContext#serverOutput()}: The server output if * available. This may be fetched when * <code>{@link Settings#getFetchServerOutputSize()} &gt; 0</code></li> * </ul> * <p> * Overridable attributes in <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#resultSet(ResultSet)}: The * <code>ResultSet</code> that is about to be fetched. You can modify this * result set freely, or wrap {@link ExecuteContext#resultSet()} with your * enriched result set wrapper</li> * </ul> */
void executeEnd(ExecuteContext ctx);
Called before fetching out parameter values from a CallableStatement.

Available attributes from ExecuteContext:

Note that this method is called only when executing standalone routine calls.

/** * Called before fetching out parameter values from a * <code>CallableStatement</code>. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * </li> * <li>{@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or <code>null</code> if no warning was * emitted.</li> * </ul> * <p> * Note that this method is called only when executing standalone routine * calls. */
void outStart(ExecuteContext ctx);
Called after fetching out parameter values from a CallableStatement.

Available attributes from ExecuteContext:

Note that this method is called only when executing standalone routine calls.

/** * Called after fetching out parameter values from a * <code>CallableStatement</code>. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * <li>{@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or <code>null</code> if no warning was * emitted.</li> * </ul> * <p> * Note that this method is called only when executing standalone routine * calls. */
void outEnd(ExecuteContext ctx);
Called before fetching data from a ResultSet.

Available attributes from ExecuteContext:

Overridable attributes in ExecuteContext:

In case of multiple ResultSets with ResultQuery.fetchMany(), this is called several times, once per ResultSet

Note that this method is not called when executing queries that do not return a result, or when executing routines.

/** * Called before fetching data from a <code>ResultSet</code>. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.PreparedStatement</code> from your JDBC driver when * a jOOQ <code>Query</code> is being executed as * {@link StatementType#PREPARED_STATEMENT}</li> * <li>A <code>java.sql.Statement</code> from your JDBC driver wrapped in a * <code>java.sql.PreparedStatement</code> when your jOOQ <code>Query</code> * is being executed as {@link StatementType#STATIC_STATEMENT}</li> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * </li> * <li>{@link ExecuteContext#resultSet()}: The <code>ResultSet</code> that * is about to be fetched.</li> * <li>{@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or <code>null</code> if no warning was * emitted.</li> * </ul> * <p> * Overridable attributes in <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#resultSet(ResultSet)}: The * <code>ResultSet</code> that is about to be fetched. You can modify this * result set freely, or wrap {@link ExecuteContext#resultSet()} with your * enriched result set wrapper</li> * </ul> * <p> * In case of multiple <code>ResultSets</code> with * {@link ResultQuery#fetchMany()}, this is called several times, once per * <code>ResultSet</code> * <p> * Note that this method is not called when executing queries that do not * return a result, or when executing routines. */
void fetchStart(ExecuteContext ctx);
Called before fetching a set of records from a ResultSet.

Available attributes from ExecuteContext:

Note that this method is not called when executing queries that do not return a result, or when executing routines. This is also not called when fetching single records, with Cursor.fetchNext() for instance.

/** * Called before fetching a set of records from a <code>ResultSet</code>. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.PreparedStatement</code> from your JDBC driver when * a jOOQ <code>Query</code> is being executed as * {@link StatementType#PREPARED_STATEMENT}</li> * <li>A <code>java.sql.Statement</code> from your JDBC driver wrapped in a * <code>java.sql.PreparedStatement</code> when your jOOQ <code>Query</code> * is being executed as {@link StatementType#STATIC_STATEMENT}</li> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * </li> * <li>{@link ExecuteContext#resultSet()}: The <code>ResultSet</code> that * is about to be fetched.</li> * <li>{@link ExecuteContext#result()}: The set of records that are about to * be fetched.</li> * <li>{@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or <code>null</code> if no warning was * emitted.</li> * </ul> * <p> * Note that this method is not called when executing queries that do not * return a result, or when executing routines. This is also not called when * fetching single records, with {@link Cursor#fetchNext()} for instance. */
void resultStart(ExecuteContext ctx);
Called before fetching a record from a ResultSet.

Available attributes from ExecuteContext:

Note that this method is not called when executing queries that do not return a result, or when executing routines.

/** * Called before fetching a record from a <code>ResultSet</code>. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.PreparedStatement</code> from your JDBC driver when * a jOOQ <code>Query</code> is being executed as * {@link StatementType#PREPARED_STATEMENT}</li> * <li>A <code>java.sql.Statement</code> from your JDBC driver wrapped in a * <code>java.sql.PreparedStatement</code> when your jOOQ <code>Query</code> * is being executed as {@link StatementType#STATIC_STATEMENT}</li> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * </li> * <li>{@link ExecuteContext#resultSet()}: The <code>ResultSet</code> that * is about to be fetched.</li> * <li>{@link ExecuteContext#record()}: The <code>Record</code> that is * about to be fetched.</li> * <li>{@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or <code>null</code> if no warning was * emitted.</li> * </ul> * <p> * Note that this method is not called when executing queries that do not * return a result, or when executing routines. */
void recordStart(ExecuteContext ctx);
Called after fetching a record from a ResultSet.

Available attributes from ExecuteContext:

Note that this method is not called when executing queries that do not return a result, or when executing routines.

/** * Called after fetching a record from a <code>ResultSet</code>. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.PreparedStatement</code> from your JDBC driver when * a jOOQ <code>Query</code> is being executed as * {@link StatementType#PREPARED_STATEMENT}</li> * <li>A <code>java.sql.Statement</code> from your JDBC driver wrapped in a * <code>java.sql.PreparedStatement</code> when your jOOQ <code>Query</code> * is being executed as {@link StatementType#STATIC_STATEMENT}</li> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * </li> * <li>{@link ExecuteContext#resultSet()}: The <code>ResultSet</code> that * is about to be fetched.</li> * <li>{@link ExecuteContext#record()}: The last <code>Record</code> that * was fetched.</li> * <li>{@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or <code>null</code> if no warning was * emitted.</li> * </ul> * <p> * Note that this method is not called when executing queries that do not * return a result, or when executing routines. */
void recordEnd(ExecuteContext ctx);
Called after fetching a set of records from a ResultSet.

Available attributes from ExecuteContext:

Note that this method is not called when executing queries that do not return a result, or when executing routines. This is also not called when fetching single records, with Cursor.fetchNext() for instance.

/** * Called after fetching a set of records from a <code>ResultSet</code>. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.PreparedStatement</code> from your JDBC driver when * a jOOQ <code>Query</code> is being executed as * {@link StatementType#PREPARED_STATEMENT}</li> * <li>A <code>java.sql.Statement</code> from your JDBC driver wrapped in a * <code>java.sql.PreparedStatement</code> when your jOOQ <code>Query</code> * is being executed as {@link StatementType#STATIC_STATEMENT}</li> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * </li> * <li>{@link ExecuteContext#resultSet()}: The <code>ResultSet</code> that * is about to be fetched.</li> * <li>{@link ExecuteContext#record()}: The last <code>Record</code> that * was fetched.</li> * <li>{@link ExecuteContext#result()}: The set of records that were * fetched.</li> * <li>{@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or <code>null</code> if no warning was * emitted.</li> * </ul> * <p> * Note that this method is not called when executing queries that do not * return a result, or when executing routines. This is also not called when * fetching single records, with {@link Cursor#fetchNext()} for instance. */
void resultEnd(ExecuteContext ctx);
Called after fetching data from a ResultSet.

Available attributes from ExecuteContext:

In case of multiple ResultSets with ResultQuery.fetchMany(), this is called several times, once per ResultSet

Note that this method is not called when executing queries that do not return a result, or when executing routines.

/** * Called after fetching data from a <code>ResultSet</code>. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.PreparedStatement</code> from your JDBC driver when * a jOOQ <code>Query</code> is being executed as * {@link StatementType#PREPARED_STATEMENT}</li> * <li>A <code>java.sql.Statement</code> from your JDBC driver wrapped in a * <code>java.sql.PreparedStatement</code> when your jOOQ <code>Query</code> * is being executed as {@link StatementType#STATIC_STATEMENT}</li> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * Note that the <code>Statement</code> is already closed!</li> * <li>{@link ExecuteContext#resultSet()}: The <code>ResultSet</code> that * was fetched. Note that the <code>ResultSet</code> is already closed!</li> * <li>{@link ExecuteContext#rows()}: The number of affected rows if * applicable.</li> * <li>{@link ExecuteContext#serverOutput()}: The server output if * available. This may be fetched when * <code>{@link Settings#getFetchServerOutputSize()} &gt; 0</code></li> * <li>{@link ExecuteContext#record()}: The last <code>Record</code> that * was fetched.</li> * <li>{@link ExecuteContext#result()}: The last set of records that were * fetched.</li> * <li>{@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or <code>null</code> if no warning was * emitted.</li> * </ul> * <p> * In case of multiple <code>ResultSets</code> with * {@link ResultQuery#fetchMany()}, this is called several times, once per * <code>ResultSet</code> * <p> * Note that this method is not called when executing queries that do not * return a result, or when executing routines. */
void fetchEnd(ExecuteContext ctx);
Called at the end of the execution lifecycle.

Available attributes from ExecuteContext:

/** * Called at the end of the execution lifecycle. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.PreparedStatement</code> from your JDBC driver when * a jOOQ <code>Query</code> is being executed as * {@link StatementType#PREPARED_STATEMENT}</li> * <li>A <code>java.sql.Statement</code> from your JDBC driver wrapped in a * <code>java.sql.PreparedStatement</code> when your jOOQ <code>Query</code> * is being executed as {@link StatementType#STATIC_STATEMENT}</li> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * Note that the <code>Statement</code> is already closed!</li> * <li>{@link ExecuteContext#resultSet()}: The <code>ResultSet</code> that * was fetched or <code>null</code>, if no result set was fetched. Note that * the <code>ResultSet</code> may already be closed!</li> * <li>{@link ExecuteContext#rows()}: The number of affected rows if * applicable.</li> * <li>{@link ExecuteContext#serverOutput()}: The server output if * available. This may be fetched when * <code>{@link Settings#getFetchServerOutputSize()} &gt; 0</code></li> * <li>{@link ExecuteContext#record()}: The last <code>Record</code> that * was fetched or null if no records were fetched.</li> * <li>{@link ExecuteContext#result()}: The last set of records that were * fetched or null if no records were fetched.</li> * <li>{@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or <code>null</code> if no warning was * emitted.</li> * </ul> */
void end(ExecuteContext ctx);
Called in the event of an exception at any moment of the execution lifecycle.

Available attributes from ExecuteContext:

/** * Called in the event of an exception at any moment of the execution * lifecycle. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.PreparedStatement</code> from your JDBC driver when * a jOOQ <code>Query</code> is being executed as * {@link StatementType#PREPARED_STATEMENT}</li> * <li>A <code>java.sql.Statement</code> from your JDBC driver wrapped in a * <code>java.sql.PreparedStatement</code> when your jOOQ <code>Query</code> * is being executed as {@link StatementType#STATIC_STATEMENT}</li> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * Note that the <code>Statement</code> may be closed!</li> * <li>{@link ExecuteContext#resultSet()}: The <code>ResultSet</code> that * was fetched or <code>null</code>, if no result set was fetched. Note that * the <code>ResultSet</code> may already be closed!</li> * <li>{@link ExecuteContext#rows()}: The number of affected rows if * applicable.</li> * <li>{@link ExecuteContext#serverOutput()}: The server output if * available. This may be fetched when * <code>{@link Settings#getFetchServerOutputSize()} &gt; 0</code></li> * <li>{@link ExecuteContext#record()}: The last <code>Record</code> that * was fetched or null if no records were fetched.</li> * <li>{@link ExecuteContext#result()}: The last set of records that were * fetched or null if no records were fetched.</li> * <li>{@link ExecuteContext#exception()}: The {@link RuntimeException} that * is about to be thrown</li> * <li>{@link ExecuteContext#sqlException()}: The {@link SQLException} that * was thrown by the database</li> * </ul> */
void exception(ExecuteContext ctx);
Called in the event of a warning at any moment of the execution lifecycle.

Available attributes from ExecuteContext:

This method is only invoked if a warning appears. Note that fetching of warnings can be disabled using Settings.isFetchWarnings()

/** * Called in the event of a warning at any moment of the execution * lifecycle. * <p> * Available attributes from <code>ExecuteContext</code>: * <ul> * <li>{@link ExecuteContext#connection()}: The connection used for * execution</li> * <li>{@link ExecuteContext#configuration()}: The execution * configuration</li> * <li>{@link ExecuteContext#query()}: The <code>Query</code> object, if a * jOOQ query is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#routine()}: The <code>Routine</code> object, if * a jOOQ routine is being executed or <code>null</code> otherwise</li> * <li>{@link ExecuteContext#sql()}: The rendered <code>SQL</code> statement * that is about to be executed, or <code>null</code> if the * <code>SQL</code> statement is unknown..</li> * <li>{@link ExecuteContext#statement()}: The * <code>PreparedStatement</code> that is about to be executed, or * <code>null</code> if no statement is known to jOOQ. This can be any of * the following: <br/> * <br/> * <ul> * <li>A <code>java.sql.PreparedStatement</code> from your JDBC driver when * a jOOQ <code>Query</code> is being executed as * {@link StatementType#PREPARED_STATEMENT}</li> * <li>A <code>java.sql.Statement</code> from your JDBC driver wrapped in a * <code>java.sql.PreparedStatement</code> when your jOOQ <code>Query</code> * is being executed as {@link StatementType#STATIC_STATEMENT}</li> * <li>A <code>java.sql.CallableStatement</code> when you are executing a * jOOQ <code>Routine</code></li> * </ul> * Note that the <code>Statement</code> may be closed!</li> * <li>{@link ExecuteContext#resultSet()}: The <code>ResultSet</code> that * was fetched or <code>null</code>, if no result set was fetched. Note that * the <code>ResultSet</code> may already be closed!</li> * <li>{@link ExecuteContext#rows()}: The number of affected rows if * applicable.</li> * <li>{@link ExecuteContext#serverOutput()}: The server output if * available. This may be fetched when * <code>{@link Settings#getFetchServerOutputSize()} &gt; 0</code></li> * <li>{@link ExecuteContext#record()}: The last <code>Record</code> that * was fetched or null if no records were fetched.</li> * <li>{@link ExecuteContext#result()}: The last set of records that were * fetched or null if no records were fetched.</li> * <li>{@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database</li> * <li>{@link ExecuteContext#exception()}: The {@link RuntimeException} that * is about to be thrown or <code>null</code>, if no exception is being * thrown.</li> * <li>{@link ExecuteContext#sqlException()}: The {@link SQLException} that * was thrown by the database or <code>null</code>, if no exception is being * thrown.</li> * </ul> * <p> * This method is only invoked if a warning appears. Note that fetching of * warnings can be disabled using {@link Settings#isFetchWarnings()} */
void warning(ExecuteContext ctx); }