-
public interface TriggerData
The data passed to an ordinary (insert/update/delete/truncate) trigger function. The SQL 2003 spec. does not stipulate a standard way of mapping triggers to functions. The PLJava mapping use this interface. All functions that are intended to be triggers must be public, static, return void, and take aTriggerData
as their argument.- Author:
- Thomas Hallgren
-
-
Method Summary
Modifier and Type Method Description String[]
getArguments()
Returns the arguments for this trigger (as declared in theCREATE TRIGGER
statement.String
getName()
Returns the name of the trigger (as declared in theCREATE TRIGGER
statement).ResultSet
getNew()
Returns the ResultSet that represents the new row.ResultSet
getOld()
Returns the ResultSet that represents the old row.String
getSchemaName()
Returns the name of the schema of the table for which this trigger was created (as declared in theCREATE TRIGGER
statement).String
getTableName()
Returns the name of the table for which this trigger was created (as declared in theCREATE TRIGGER
statement).boolean
isFiredAfter()
Returnstrue
if the trigger was fired after the statement or row action that it is associated with.boolean
isFiredBefore()
Returnstrue
if the trigger was fired before the statement or row action that it is associated with.boolean
isFiredByDelete()
Returnstrue
if this trigger was fired by aDELETE
.boolean
isFiredByInsert()
Returnstrue
if this trigger was fired by anINSERT
.boolean
isFiredByUpdate()
Returnstrue
if this trigger was fired by anUPDATE
.boolean
isFiredForEachRow()
Returnstrue
if this trigger is fired once for each row (as opposed to once for the entire statement).boolean
isFiredForStatement()
Returnstrue
if this trigger is fired once for the entire statement (as opposed to once for each row).void
suppress()
Advise PostgreSQL to silently suppress the operation on this row.
-
-
-
Method Detail
-
getNew
ResultSet getNew() throws SQLException
Returns the ResultSet that represents the new row. This ResultSet will be null for delete triggers and for triggers that were fired for statement.
The returned set will be updateable and positioned on a valid row. When the trigger call returns, the trigger manager will see the changes that has been made to this row and construct a new tuple which will become the new or updated row.- Returns:
- An updateable
ResultSet
containing one row ornull
. - Throws:
SQLException
- if the contained native buffer has gone stale.
-
getOld
ResultSet getOld() throws SQLException
Returns the ResultSet that represents the old row. This ResultSet will be null for insert triggers and for triggers that were fired for statement.
The returned set will be read-only and positioned on a valid row.- Returns:
- A read-only
ResultSet
containing one row ornull
. - Throws:
SQLException
- if the contained native buffer has gone stale.
-
getArguments
String[] getArguments() throws SQLException
Returns the arguments for this trigger (as declared in theCREATE TRIGGER
statement. If the trigger has no arguments, this method will return an array with size 0.- Throws:
SQLException
- if the contained native buffer has gone stale.
-
getName
String getName() throws SQLException
Returns the name of the trigger (as declared in theCREATE TRIGGER
statement).- Throws:
SQLException
- if the contained native buffer has gone stale.
-
getTableName
String getTableName() throws SQLException
Returns the name of the table for which this trigger was created (as declared in theCREATE TRIGGER
statement).- Throws:
SQLException
- if the contained native buffer has gone stale.
-
getSchemaName
String getSchemaName() throws SQLException
Returns the name of the schema of the table for which this trigger was created (as declared in theCREATE TRIGGER
statement).- Throws:
SQLException
- if the contained native buffer has gone stale.
-
isFiredAfter
boolean isFiredAfter() throws SQLException
Returnstrue
if the trigger was fired after the statement or row action that it is associated with.- Throws:
SQLException
- if the contained native buffer has gone stale.
-
isFiredBefore
boolean isFiredBefore() throws SQLException
Returnstrue
if the trigger was fired before the statement or row action that it is associated with.- Throws:
SQLException
- if the contained native buffer has gone stale.
-
isFiredForEachRow
boolean isFiredForEachRow() throws SQLException
Returnstrue
if this trigger is fired once for each row (as opposed to once for the entire statement).- Throws:
SQLException
- if the contained native buffer has gone stale.
-
isFiredForStatement
boolean isFiredForStatement() throws SQLException
Returnstrue
if this trigger is fired once for the entire statement (as opposed to once for each row).- Throws:
SQLException
- if the contained native buffer has gone stale.
-
isFiredByDelete
boolean isFiredByDelete() throws SQLException
Returnstrue
if this trigger was fired by aDELETE
.- Throws:
SQLException
- if the contained native buffer has gone stale.
-
isFiredByInsert
boolean isFiredByInsert() throws SQLException
Returnstrue
if this trigger was fired by anINSERT
.- Throws:
SQLException
- if the contained native buffer has gone stale.
-
isFiredByUpdate
boolean isFiredByUpdate() throws SQLException
Returnstrue
if this trigger was fired by anUPDATE
.- Throws:
SQLException
- if the contained native buffer has gone stale.
-
suppress
void suppress() throws SQLException
Advise PostgreSQL to silently suppress the operation on this row.- Throws:
SQLException
- if called in anAFTER
or aSTATEMENT
trigger
-
-