All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jooq.ExecuteListener Maven / Gradle / Ivy

There is a newer version: 3.19.11
Show newest version
/**
 * Copyright (c) 2009-2016, Data Geekery GmbH (http://www.datageekery.com)
 * All rights reserved.
 *
 * 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;
import org.jooq.tools.StopWatchListener;

/**
 * An event listener for {@link Query}, {@link Routine}, or {@link 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 {@link DSLContext} * using the {@link Configuration#executeListenerProviders()} property, passing * Settings 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 ExecuteListeners can also * provide custom implementations of {@link Connection}, * {@link PreparedStatement}, {@link ResultSet}, {@link SQLException} or * {@link RuntimeException} to jOOQ in appropriate methods. *

* 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. *

* 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 methodUse case [1]Use case [2]Use case [3]Use case [4]Use case [5]Use case [6]
{@link #start(ExecuteContext)}Yes, 1xYes, 1xYes, 1xYes, 1xYes, 1xYes, 1x
{@link #renderStart(ExecuteContext)}Yes, 1xYes, 1xNoYes, 1xYes, Nx (for every query)Yes, 1x
{@link #renderEnd(ExecuteContext)}Yes, 1xYes, 1xNoYes, 1xYes, Nx (for every query)Yes, 1x
{@link #prepareStart(ExecuteContext)}Yes, 1xYes, 1xNoYes, 1xYes, Nx (for every query)Yes, 1x
{@link #prepareEnd(ExecuteContext)}Yes, 1xYes, 1xNoYes, 1xYes, Nx (for every query)Yes, 1x
{@link #bindStart(ExecuteContext)}Yes, 1xNoNoYes, Nx (for every value set)NoYes, 1x
{@link #bindEnd(ExecuteContext)}Yes, 1xNoNoYes, Nx (for every value set)NoYes, 1 *
{@link #executeStart(ExecuteContext)}Yes, 1xYes, 1xNoYes, 1xYes, 1xYes, 1x
{@link #executeEnd(ExecuteContext)}Yes, 1xYes, 1xNoYes, 1xYes, 1xYes, 1x
{@link #outStart(ExecuteContext)}NoNoNoNoNoYes, 1x
{@link #outEnd(ExecuteContext)}NoNoNoNoNoYes, 1x
{@link #fetchStart(ExecuteContext)}Yes, 1x (Nx for {@link ResultQuery#fetchMany()}Yes, 1x (Nx for {@link ResultQuery#fetchMany()}Yes, 1xNoNoNo
{@link #resultStart(ExecuteContext)}Yes, 1x (Nx for {@link Cursor#fetch(int)}Yes, 1x (Nx for {@link Cursor#fetch(int)}Yes, 1xNoNoNo
{@link #recordStart(ExecuteContext)}
*
Yes, NxYes, NxYes, NxNoNoNo
{@link #recordEnd(ExecuteContext)}Yes, NxYes, NxYes, NxNoNoNo
{@link #resultEnd(ExecuteContext)}Yes, 1x (Nx for {@link Cursor#fetch(int)}Yes, 1x (Nx for {@link Cursor#fetch(int)}Yes, 1xNoNoNo
{@link #fetchEnd(ExecuteContext)}Yes, 1x (Nx for {@link ResultQuery#fetchMany()}Yes, 1x (Nx for {@link ResultQuery#fetchMany()}Yes, 1xNoNoNo
{@link #end(ExecuteContext)}Yes, 1xYes, 1xYes, 1xYes, 1xYes, 1xYes, 1x
{@link #warning(ExecuteContext)}Maybe, 1xMaybe, 1xMaybe, 1xMaybe, 1xMaybe, 1xMaybe, 1x
{@link #exception(ExecuteContext)}Maybe, 1xMaybe, 1xMaybe, 1xMaybe, 1xMaybe, 1xMaybe, 1x
*
*

*

Legend:
*

*

    *
  1. Used with {@link ResultQuery} of statement type * {@link StatementType#PREPARED_STATEMENT}
  2. *
  3. Used with {@link ResultQuery} of statement type * {@link StatementType#STATIC_STATEMENT}
  4. *
  5. Used with {@link DSLContext#fetch(ResultSet)} or with * {@link InsertResultStep#fetch()}
  6. *
  7. Used with {@link DSLContext#batch(Query)}
  8. *
  9. Used with {@link DSLContext#batch(Query[])}
  10. *
  11. Used with {@link DSLContext#batch(Queries)}
  12. *
  13. Used with a {@link Routine} standalone call
  14. *
*

* If nothing is specified, the default is to use {@link LoggerListener} and * {@link StopWatchListener} as the only event listeners, as configured in * {@link Settings#isExecuteLogging()} * * @author Lukas Eder */ public interface ExecuteListener extends EventListener, Serializable { /** * Called to initialise an ExecuteListener *

* Available attributes from ExecuteContext: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
* Overridable attributes in ExecuteContext: *
    *
  • {@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
  • *
*/ void start(ExecuteContext ctx); /** * Called before rendering SQL from a QueryPart *

* Available attributes from ExecuteContext: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
*/ void renderStart(ExecuteContext ctx); /** * Called after rendering SQL from a QueryPart *

* Available attributes from ExecuteContext: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
*

* Overridable attributes in ExecuteContext: *

    *
  • {@link ExecuteContext#sql(String)}: The rendered SQL * statement that is about to be executed. You can modify this statement * freely.
  • *
*/ void renderEnd(ExecuteContext ctx); /** * Called before preparing / creating the SQL statement *

* Available attributes from ExecuteContext: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
*

* Overridable attributes in ExecuteContext: *

    *
  • {@link ExecuteContext#sql(String)}: The rendered SQL * statement that is about to be executed. You can modify this statement * freely.
  • *
*/ void prepareStart(ExecuteContext ctx); /** * Called after preparing / creating the SQL statement *

* Available attributes from ExecuteContext: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
  • {@link ExecuteContext#statement()}: The * PreparedStatement that is about to be executed, or * null if no statement is known to jOOQ. This can be any of * the following:
    *
    *
      *
    • A java.sql.PreparedStatement from your JDBC driver when * a jOOQ Query is being executed as * {@link StatementType#PREPARED_STATEMENT}
    • *
    • A java.sql.Statement from your JDBC driver wrapped in a * java.sql.PreparedStatement when your jOOQ Query * is being executed as {@link StatementType#STATIC_STATEMENT}
    • *
    • A java.sql.CallableStatement when you are executing a * jOOQ Routine
    • *
    *
  • *
*

* Overridable attributes in ExecuteContext: *

    *
  • {@link ExecuteContext#statement(PreparedStatement)}: The * Statement, PreparedStatement, or * CallableStatement that is about to be executed. You can * modify this statement freely, or wrap {@link ExecuteContext#statement()} * with your enriched statement wrapper
  • *
*/ void prepareEnd(ExecuteContext ctx); /** * Called before binding variables to the PreparedStatement *

* Available attributes from ExecuteContext: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
  • {@link ExecuteContext#statement()}: The * PreparedStatement that is about to be executed, or * null if no statement is known to jOOQ. This can be any of * the following:
    *
    *
      *
    • A java.sql.PreparedStatement from your JDBC driver when * a jOOQ Query is being executed as * {@link StatementType#PREPARED_STATEMENT}
    • *
    • A java.sql.CallableStatement when you are executing a * jOOQ Routine
    • *
    *
  • *
*

* Overridable attributes in ExecuteContext: *

    *
  • {@link ExecuteContext#statement(PreparedStatement)}: The * PreparedStatement, or CallableStatement that is * about to be executed. You can modify this statement freely, or wrap * {@link ExecuteContext#statement()} with your enriched statement wrapper
  • *
*

* Note that this method is not called when executing queries of type * {@link StatementType#STATIC_STATEMENT} */ void bindStart(ExecuteContext ctx); /** * Called after binding variables to the PreparedStatement *

* Available attributes from ExecuteContext: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
  • {@link ExecuteContext#statement()}: The * PreparedStatement that is about to be executed, or * null if no statement is known to jOOQ. This can be any of * the following:
    *
    *
      *
    • A java.sql.PreparedStatement from your JDBC driver when * a jOOQ Query is being executed as * {@link StatementType#PREPARED_STATEMENT}
    • *
    • A java.sql.CallableStatement when you are executing a * jOOQ Routine
    • *
    *
  • *
*

* Overridable attributes in ExecuteContext: *

    *
  • {@link ExecuteContext#statement(PreparedStatement)}: The * Statement, PreparedStatement, or * CallableStatement that is about to be executed. You can * modify this statement freely, or wrap {@link ExecuteContext#statement()} * with your enriched statement wrapper
  • *
*

* 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: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
  • {@link ExecuteContext#statement()}: The * PreparedStatement that is about to be executed, or * null if no statement is known to jOOQ. This can be any of * the following:
    *
    *
      *
    • A java.sql.PreparedStatement from your JDBC driver when * a jOOQ Query is being executed as * {@link StatementType#PREPARED_STATEMENT}
    • *
    • A java.sql.Statement from your JDBC driver wrapped in a * java.sql.PreparedStatement when your jOOQ Query * is being executed as {@link StatementType#STATIC_STATEMENT}
    • *
    • A java.sql.CallableStatement when you are executing a * jOOQ Routine
    • *
    *
  • *
*

* Overridable attributes in ExecuteContext: *

    *
  • {@link ExecuteContext#statement(PreparedStatement)}: The * Statement, PreparedStatement, or * CallableStatement that is about to be executed. You can * modify this statement freely, or wrap {@link ExecuteContext#statement()} * with your enriched statement wrapper
  • *
*/ void executeStart(ExecuteContext ctx); /** * Called after executing a statement *

* Available attributes from ExecuteContext: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
  • {@link ExecuteContext#statement()}: The * PreparedStatement that is about to be executed, or * null if no statement is known to jOOQ. This can be any of * the following:
    *
    *
      *
    • A java.sql.PreparedStatement from your JDBC driver when * a jOOQ Query is being executed as * {@link StatementType#PREPARED_STATEMENT}
    • *
    • A java.sql.Statement from your JDBC driver wrapped in a * java.sql.PreparedStatement when your jOOQ Query * is being executed as {@link StatementType#STATIC_STATEMENT}
    • *
    • A java.sql.CallableStatement when you are executing a * jOOQ Routine
    • *
    *
  • *
  • {@link ExecuteContext#resultSet()}: The ResultSet that * is about to be fetched or null, if the Query * returns no result set, or if a Routine is being executed.
  • *
  • {@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.
  • *
*

* Overridable attributes in ExecuteContext: *

    *
  • {@link ExecuteContext#resultSet(ResultSet)}: The * ResultSet that is about to be fetched. You can modify this * result set freely, or wrap {@link ExecuteContext#resultSet()} with your * enriched result set wrapper
  • *
*/ void executeEnd(ExecuteContext ctx); /** * Called before fetching out parameter values from a * CallableStatement. *

* Available attributes from ExecuteContext: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
  • {@link ExecuteContext#statement()}: The * PreparedStatement that is about to be executed, or * null if no statement is known to jOOQ. This can be any of * the following:
    *
    *
      *
    • A java.sql.CallableStatement when you are executing a * jOOQ Routine
    • *
    *
  • *
  • {@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or null if no warning was emitted.
  • *
*

* 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: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
  • {@link ExecuteContext#statement()}: The * PreparedStatement that is about to be executed, or * null if no statement is known to jOOQ. This can be any of * the following:
    *
    *
      *
    • A java.sql.CallableStatement when you are executing a * jOOQ Routine
    • *
    *
  • {@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or null if no warning was emitted.
  • *
*

* 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: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
  • {@link ExecuteContext#statement()}: The * PreparedStatement that is about to be executed, or * null if no statement is known to jOOQ. This can be any of * the following:
    *
    *
      *
    • A java.sql.PreparedStatement from your JDBC driver when * a jOOQ Query is being executed as * {@link StatementType#PREPARED_STATEMENT}
    • *
    • A java.sql.Statement from your JDBC driver wrapped in a * java.sql.PreparedStatement when your jOOQ Query * is being executed as {@link StatementType#STATIC_STATEMENT}
    • *
    • A java.sql.CallableStatement when you are executing a * jOOQ Routine
    • *
    *
  • *
  • {@link ExecuteContext#resultSet()}: The ResultSet that * is about to be fetched.
  • *
  • {@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or null if no warning was emitted.
  • *
*

* Overridable attributes in ExecuteContext: *

    *
  • {@link ExecuteContext#resultSet(ResultSet)}: The * ResultSet that is about to be fetched. You can modify this * result set freely, or wrap {@link ExecuteContext#resultSet()} with your * enriched result set wrapper
  • *
*

* In case of multiple ResultSets with * {@link 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. */ void fetchStart(ExecuteContext ctx); /** * Called before fetching a set of records from a ResultSet *

* Available attributes from ExecuteContext: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
  • {@link ExecuteContext#statement()}: The * PreparedStatement that is about to be executed, or * null if no statement is known to jOOQ. This can be any of * the following:
    *
    *
      *
    • A java.sql.PreparedStatement from your JDBC driver when * a jOOQ Query is being executed as * {@link StatementType#PREPARED_STATEMENT}
    • *
    • A java.sql.Statement from your JDBC driver wrapped in a * java.sql.PreparedStatement when your jOOQ Query * is being executed as {@link StatementType#STATIC_STATEMENT}
    • *
    • A java.sql.CallableStatement when you are executing a * jOOQ Routine
    • *
    *
  • *
  • {@link ExecuteContext#resultSet()}: The ResultSet that * is about to be fetched.
  • *
  • {@link ExecuteContext#result()}: The set of records that are about to * be fetched.
  • *
  • {@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or null if no warning was emitted.
  • *
*

* 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#fetchOne()} for instance. */ void resultStart(ExecuteContext ctx); /** * Called before fetching a record from a ResultSet *

* Available attributes from ExecuteContext: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
  • {@link ExecuteContext#statement()}: The * PreparedStatement that is about to be executed, or * null if no statement is known to jOOQ. This can be any of * the following:
    *
    *
      *
    • A java.sql.PreparedStatement from your JDBC driver when * a jOOQ Query is being executed as * {@link StatementType#PREPARED_STATEMENT}
    • *
    • A java.sql.Statement from your JDBC driver wrapped in a * java.sql.PreparedStatement when your jOOQ Query * is being executed as {@link StatementType#STATIC_STATEMENT}
    • *
    • A java.sql.CallableStatement when you are executing a * jOOQ Routine
    • *
    *
  • *
  • {@link ExecuteContext#resultSet()}: The ResultSet that * is about to be fetched.
  • *
  • {@link ExecuteContext#record()}: The Record that is * about to be fetched.
  • *
  • {@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or null if no warning was emitted.
  • *
*

* 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: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
  • {@link ExecuteContext#statement()}: The * PreparedStatement that is about to be executed, or * null if no statement is known to jOOQ. This can be any of * the following:
    *
    *
      *
    • A java.sql.PreparedStatement from your JDBC driver when * a jOOQ Query is being executed as * {@link StatementType#PREPARED_STATEMENT}
    • *
    • A java.sql.Statement from your JDBC driver wrapped in a * java.sql.PreparedStatement when your jOOQ Query * is being executed as {@link StatementType#STATIC_STATEMENT}
    • *
    • A java.sql.CallableStatement when you are executing a * jOOQ Routine
    • *
    *
  • *
  • {@link ExecuteContext#resultSet()}: The ResultSet that * is about to be fetched.
  • *
  • {@link ExecuteContext#record()}: The last Record that * was fetched.
  • *
  • {@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or null if no warning was emitted.
  • *
*

* 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: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
  • {@link ExecuteContext#statement()}: The * PreparedStatement that is about to be executed, or * null if no statement is known to jOOQ. This can be any of * the following:
    *
    *
      *
    • A java.sql.PreparedStatement from your JDBC driver when * a jOOQ Query is being executed as * {@link StatementType#PREPARED_STATEMENT}
    • *
    • A java.sql.Statement from your JDBC driver wrapped in a * java.sql.PreparedStatement when your jOOQ Query * is being executed as {@link StatementType#STATIC_STATEMENT}
    • *
    • A java.sql.CallableStatement when you are executing a * jOOQ Routine
    • *
    *
  • *
  • {@link ExecuteContext#resultSet()}: The ResultSet that * is about to be fetched.
  • *
  • {@link ExecuteContext#record()}: The last Record that * was fetched.
  • *
  • {@link ExecuteContext#result()}: The set of records that were * fetched.
  • *
  • {@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or null if no warning was emitted.
  • *
*

* 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#fetchOne()} for instance. */ void resultEnd(ExecuteContext ctx); /** * Called after fetching data from a ResultSet. *

* Available attributes from ExecuteContext: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
  • {@link ExecuteContext#statement()}: The * PreparedStatement that is about to be executed, or * null if no statement is known to jOOQ. This can be any of * the following:
    *
    *
      *
    • A java.sql.PreparedStatement from your JDBC driver when * a jOOQ Query is being executed as * {@link StatementType#PREPARED_STATEMENT}
    • *
    • A java.sql.Statement from your JDBC driver wrapped in a * java.sql.PreparedStatement when your jOOQ Query * is being executed as {@link StatementType#STATIC_STATEMENT}
    • *
    • A java.sql.CallableStatement when you are executing a * jOOQ Routine
    • *
    * Note that the Statement is already closed!
  • *
  • {@link ExecuteContext#resultSet()}: The ResultSet that * was fetched. Note that the ResultSet is already closed!
  • *
  • {@link ExecuteContext#rows()}: The number of affected rows if * applicable.
  • *
  • {@link ExecuteContext#record()}: The last Record that * was fetched.
  • *
  • {@link ExecuteContext#result()}: The last set of records that were * fetched.
  • *
  • {@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database or null if no warning was emitted.
  • *
*

* In case of multiple ResultSets with * {@link 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. */ void fetchEnd(ExecuteContext ctx); /** * Called at the end of the execution lifecycle. *

* Available attributes from ExecuteContext: *

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

* Available attributes from ExecuteContext: *

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

* Available attributes from ExecuteContext: *

    *
  • {@link ExecuteContext#connection()}: The connection used for * execution
  • *
  • {@link ExecuteContext#configuration()}: The execution configuration
  • *
  • {@link ExecuteContext#query()}: The Query object, if a * jOOQ query is being executed or null otherwise
  • *
  • {@link ExecuteContext#routine()}: The Routine object, if * a jOOQ routine is being executed or null otherwise
  • *
  • {@link ExecuteContext#sql()}: The rendered SQL statement * that is about to be executed, or null if the * SQL statement is unknown..
  • *
  • {@link ExecuteContext#statement()}: The * PreparedStatement that is about to be executed, or * null if no statement is known to jOOQ. This can be any of * the following:
    *
    *
      *
    • A java.sql.PreparedStatement from your JDBC driver when * a jOOQ Query is being executed as * {@link StatementType#PREPARED_STATEMENT}
    • *
    • A java.sql.Statement from your JDBC driver wrapped in a * java.sql.PreparedStatement when your jOOQ Query * is being executed as {@link StatementType#STATIC_STATEMENT}
    • *
    • A java.sql.CallableStatement when you are executing a * jOOQ Routine
    • *
    * Note that the Statement may be closed!
  • *
  • {@link ExecuteContext#resultSet()}: The ResultSet that * was fetched or null, if no result set was fetched. Note that * the ResultSet may already be closed!
  • *
  • {@link ExecuteContext#rows()}: The number of affected rows if * applicable.
  • *
  • {@link ExecuteContext#record()}: The last Record that * was fetched or null if no records were fetched.
  • *
  • {@link ExecuteContext#result()}: The last set of records that were * fetched or null if no records were fetched.
  • *
  • {@link ExecuteContext#sqlWarning()}: The {@link SQLWarning} that was * emitted by the database
  • *
  • {@link ExecuteContext#exception()}: The {@link RuntimeException} that * is about to be thrown or null, if no exception is being * thrown.
  • *
  • {@link ExecuteContext#sqlException()}: The {@link SQLException} that * was thrown by the database or null, if no exception is being * thrown.
  • *
*

* 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); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy