Top Description Fields Methods
org.apache.derby.iapi.db

public Interface TriggerExecutionContext

Known Direct Implementers
org.apache.derby.impl.sql.execute.InternalTriggerExecutionContext
Imports
java.sql.ResultSet, .SQLException, org.apache.derby.catalog.UUID

A trigger execution context holds information that is available from the context of a trigger invocation.

Field Summary

Modifier and TypeField and Description
public static final int
DELETE_EVENT

Return value from getEventType() for a delete trigger.

public static final int
INSERT_EVENT

Return value from getEventType() for an insert trigger.

public static final int
UPDATE_EVENT

Return value from getEventType() for an update trigger.

Method Summary

Modifier and TypeMethod and Description
public Long

Returns:

the last auto-increment value, or null if not found
getAutoincrementValue
(String
the fully qualified name of the identity column
identity
)

Get the last auto-increment value for the specified column.

public String

Returns:

the statement text.
getEventStatementText
()

Get the text of the statement that caused the trigger to fire.

public int

Returns:

the event type (e.g. UPDATE_EVENT)
getEventType
()

Get the type for the event that caused the trigger to fire.

public ResultSet

Returns:

the ResultSet positioned on the new row image. May return null.
getNewRow
()

Like getNewRowSet(), but returns a result set positioned on the first row of the after (new) result set.

public ResultSet

Returns:

the ResultSet containing after images of the rows changed by the triggering event. May return null.
getNewRowSet
()

Returns a result set of the new (after) images of the changed rows.

public ResultSet

Returns:

the ResultSet positioned on the old row image. May return null.
getOldRow
()

Like getOldRowSet(), but returns a result set positioned on the first row of the before (old) result set.

public ResultSet

Returns:

the ResultSet containing before images of the rows changed by the triggering event. May return null.
getOldRowSet
()

Returns a result set of the old (before) images of the changed rows.

public UUID

Returns:

the uuid of the target table
getTargetTableId
()

Get the target table UUID upon which the trigger event is declared.

public String

Returns:

the target table
getTargetTableName
()

Get the target table name upon which the trigger event is declared.

Field Detail

DELETE_EVENTback to summary
public static final int DELETE_EVENT

Return value from getEventType() for a delete trigger.

INSERT_EVENTback to summary
public static final int INSERT_EVENT

Return value from getEventType() for an insert trigger.

UPDATE_EVENTback to summary
public static final int UPDATE_EVENT

Return value from getEventType() for an update trigger.

Method Detail

getAutoincrementValueback to summary
public Long getAutoincrementValue(String identity)

Get the last auto-increment value for the specified column.

Parameters
identity:String

the fully qualified name of the identity column

Returns:Long

the last auto-increment value, or null if not found

getEventStatementTextback to summary
public String getEventStatementText()

Get the text of the statement that caused the trigger to fire.

Returns:String

the statement text.

getEventTypeback to summary
public int getEventType()

Get the type for the event that caused the trigger to fire.

Returns:int

the event type (e.g. UPDATE_EVENT)

getNewRowback to summary
public 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:ResultSet

the ResultSet positioned on the new row image. May return null.

Exceptions
SQLException:
if called after the triggering event has completed
getNewRowSetback to summary
public 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:ResultSet

the ResultSet containing after images of the rows changed by the triggering event. May return null.

Exceptions
SQLException:
if called after the triggering event has completed
getOldRowback to summary
public 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:ResultSet

the ResultSet positioned on the old row image. May return null.

Exceptions
SQLException:
if called after the triggering event has completed
getOldRowSetback to summary
public 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:ResultSet

the ResultSet containing before images of the rows changed by the triggering event. May return null.

Exceptions
SQLException:
if called after the triggering event has completed
getTargetTableIdback to summary
public UUID getTargetTableId()

Get the target table UUID upon which the trigger event is declared.

Returns:UUID

the uuid of the target table

getTargetTableNameback to summary
public String getTargetTableName()

Get the target table name upon which the trigger event is declared.

Returns:String

the target table