Interface TriggerExecutionContext

All Known Implementing Classes:
InternalTriggerExecutionContext

public interface TriggerExecutionContext
A trigger execution context holds information that is available from the context of a trigger invocation.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Return value from getEventType() for a delete trigger.
    static final int
    Return value from getEventType() for an insert trigger.
    static final int
    Return value from getEventType() for an update trigger.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the last auto-increment value for the specified column.
    Get the text of the statement that caused the trigger to fire.
    int
    Get the type for the event that caused the trigger to fire.
    Like getNewRowSet(), but returns a result set positioned on the first row of the after (new) result set.
    Returns a result set of the new (after) images of the changed rows.
    Like getOldRowSet(), but returns a result set positioned on the first row of the before (old) result set.
    Returns a result set of the old (before) images of the changed rows.
    Get the target table UUID upon which the trigger event is declared.
    Get the target table name upon which the trigger event is declared.
  • Field Details

    • UPDATE_EVENT

      static final int UPDATE_EVENT
      Return value from getEventType() for an update trigger.
      See Also:
    • DELETE_EVENT

      static final int DELETE_EVENT
      Return value from getEventType() for a delete trigger.
      See Also:
    • INSERT_EVENT

      static final int INSERT_EVENT
      Return value from getEventType() for an insert trigger.
      See Also:
  • Method Details

    • getTargetTableName

      String getTargetTableName()
      Get the target table name upon which the trigger event is declared.
      Returns:
      the target table
    • getTargetTableId

      UUID getTargetTableId()
      Get the target table UUID upon which the trigger event is declared.
      Returns:
      the uuid of the target table
    • getEventType

      int getEventType()
      Get the type for the event that caused the trigger to fire.
      Returns:
      the event type (e.g. UPDATE_EVENT)
    • getEventStatementText

      String getEventStatementText()
      Get the text of the statement that caused the trigger to fire.
      Returns:
      the statement text.
    • getOldRowSet

      ResultSet getOldRowSet() throws SQLException
      Returns a result set of the old (before) images of the changed rows. For a row trigger, this result set will have a single row. For a statement trigger, this result set has every row that has changed or will change. If a statement trigger does not affect a row, then the result set will be empty (i.e. ResultSet.next() will return false).

      Will return null if the call is inapplicable for the trigger that is currently executing. For example, will return null if called during a the firing of an INSERT trigger.

      Returns:
      the ResultSet containing before images of the rows changed by the triggering event. May return null.
      Throws:
      SQLException - if called after the triggering event has completed
    • getNewRowSet

      ResultSet getNewRowSet() throws SQLException
      Returns a result set of the new (after) images of the changed rows. For a row trigger, this result set will have a single row. For a statement trigger, this result set has every row that has changed or will change. If a statement trigger does not affect a row, then the result set will be empty (i.e. ResultSet.next() will return false).

      Will return null if the call is inapplicable for the trigger that is currently executing. For example, will return null if called during the firing of a DELETE trigger.

      Returns:
      the ResultSet containing after images of the rows changed by the triggering event. May return null.
      Throws:
      SQLException - if called after the triggering event has completed
    • getOldRow

      ResultSet getOldRow() throws SQLException
      Like getOldRowSet(), but returns a result set positioned on the first row of the before (old) result set. Used as a convenience to get a column for a row trigger. Equivalent to getOldRowSet() followed by next().

      Will return null if the call is inapplicable for the trigger that is currently executing. For example, will return null if called during a the firing of an INSERT trigger.

      Returns:
      the ResultSet positioned on the old row image. May return null.
      Throws:
      SQLException - if called after the triggering event has completed
    • getNewRow

      ResultSet getNewRow() throws SQLException
      Like getNewRowSet(), but returns a result set positioned on the first row of the after (new) result set. Used as a convenience to get a column for a row trigger. Equivalent to getNewRowSet() followed by next().

      Will return null if the call is inapplicable for the trigger that is currently executing. For example, will return null if called during the firing of a DELETE trigger.

      Returns:
      the ResultSet positioned on the new row image. May return null.
      Throws:
      SQLException - if called after the triggering event has completed
    • getAutoincrementValue

      Long getAutoincrementValue(String identity)
      Get the last auto-increment value for the specified column.
      Parameters:
      identity - the fully qualified name of the identity column
      Returns:
      the last auto-increment value, or null if not found