Package org.jooq

Interface ExecuteContext

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method 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.
      java.lang.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.
      java.sql.Connection connection()
      The connection to be used in this execute context.
      void connectionProvider​(ConnectionProvider connectionProvider)
      Override the Connection that is being used for execution.
      java.lang.RuntimeException exception()
      The RuntimeException being thrown.
      void exception​(java.lang.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.
      java.sql.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​(java.sql.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.
      java.lang.String[] serverOutput()
      Any server output collected from this statement when Settings.getFetchServerOutputSize() > 0.
      void serverOutput​(java.lang.String[] output)
      Any server output collected from this statement when Settings.getFetchServerOutputSize() > 0.
      java.lang.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​(java.lang.String sql)
      Override the SQL statement that is being executed.
      java.sql.SQLException sqlException()
      The SQLException that was thrown by the database.
      void sqlException​(java.sql.SQLException e)
      Override the SQLException being thrown.
      java.sql.SQLWarning sqlWarning()
      The SQLWarning that was emitted by the database.
      void sqlWarning​(java.sql.SQLWarning e)
      Override the SQLWarning being emitted.
      java.sql.PreparedStatement statement()
      The PreparedStatement that is being executed or null if the statement is unknown or if there was no statement.
      void statement​(java.sql.PreparedStatement statement)
      Override the PreparedStatement that is being executed.
      int statementExecutionCount()
      The number of times this particular statement has been executed.
      ExecuteType type()
      The type of database interaction that is being executed.
    • Method Detail

      • query

        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.
        See Also:
        routine(), batchQueries()
      • batchQueries

        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.

        If a single Query is executed in non-batch mode, this will return an array of length 1, containing that Query

        Returns:
        The executed Query object(s). This is never null
        See Also:
        query(), routine()
      • routine

        Routine<?> routine()
        The jOOQ Routine that is being executed or null if the query is unknown or if there was no jOOQ Routine.
        See Also:
        routine()
      • sql

        java.lang.String sql()
        The SQL that is being executed or null if the SQL statement is unknown or if there was no SQL statement.
      • batchSQL

        java.lang.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.

        If a single Query is executed in non-batch mode, this will return an array of length 1, containing that Query

        Returns:
        The generated SQL statement(s). This is never null
        See Also:
        query(), routine()
      • statement

        java.sql.PreparedStatement statement()
        The 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:

        • A java.sql.PreparedStatement from your JDBC driver when a jOOQ Query is being executed as 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 StatementType.STATIC_STATEMENT
        • A java.sql.CallableStatement when you are executing a jOOQ Routine
      • resultSet

        java.sql.ResultSet resultSet()
        The ResultSet that is being fetched or null if the result set is unknown or if no result set is being fetched.
      • record

        Record record()
        The last record that was fetched from the result set, or null if no record has been fetched.
      • record

        void record​(Record record)
        Calling this has no effect. It is used by jOOQ internally.
      • rows

        int rows()
        The number of rows that were affected by the last statement.

        This returns -1:

        • if the number of affected rows is not yet available (e.g. prior to the ExecuteListener.executeEnd(ExecuteContext) event).
        • if affected rows are not applicable for the given statement (statements that do not produce a JDBC Statement.getUpdateCount().
      • rows

        void rows​(int rows)
        Calling this has no effect. It is used by jOOQ internally.
      • batchRows

        int[] batchRows()
        The number of rows that were affected by the last statement executed in batch mode.

        If a single Query is executed in non-batch mode, this will return an array of 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.

        Returns:
        The affected rows. This is never null
        See Also:
        rows()
      • result

        Result<?> result()
        The last result that was fetched from the result set, or null if no result has been fetched.
      • result

        void result​(Result<?> result)
        Calling this has no effect. It is used by jOOQ internally.
      • exception

        java.lang.RuntimeException exception()
        The RuntimeException being thrown.
      • exception

        void exception​(java.lang.RuntimeException e)
        Override the RuntimeException being thrown.

        This may have no effect, if called at the wrong moment.

      • sqlException

        java.sql.SQLException sqlException()
        The SQLException that was thrown by the database.
      • sqlException

        void sqlException​(java.sql.SQLException e)
        Override the 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.

        If null is being passed, jOOQ will internally translate the "unavailable" exception to an unspecified DataAccessException.

      • sqlWarning

        java.sql.SQLWarning sqlWarning()
        The SQLWarning that was emitted by the database.

        Note that fetching of warnings can be disabled using Settings.isFetchWarnings(), in case of which this property will be null.

      • sqlWarning

        void sqlWarning​(java.sql.SQLWarning e)
        Override the SQLWarning being emitted.
      • serverOutput

        java.lang.String[] serverOutput()
        Any server output collected from this statement when Settings.getFetchServerOutputSize() > 0.
        Returns:
        The server output. This is never null.