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 a
TriggerData as their argument.- Author:
- Thomas Hallgren
-
Method Summary
Modifier and TypeMethodDescriptionString[]Returns the arguments for this trigger (as declared in theCREATE TRIGGERstatement.getName()Returns the name of the trigger (as declared in theCREATE TRIGGERstatement).getNew()Returns the ResultSet that represents the new row.getOld()Returns the ResultSet that represents the old row.Returns the name of the schema of the table for which this trigger was created (as declared in theCREATE TRIGGERstatement).Returns the name of the table for which this trigger was created (as declared in theCREATE TRIGGERstatement).booleanReturnstrueif the trigger was fired after the statement or row action that it is associated with.booleanReturnstrueif the trigger was fired before the statement or row action that it is associated with.booleanReturnstrueif this trigger was fired by aDELETE.booleanReturnstrueif this trigger was fired by anINSERT.booleanReturnstrueif this trigger was fired by anUPDATE.booleanReturnstrueif this trigger is fired once for each row (as opposed to once for the entire statement).booleanReturnstrueif this trigger is fired once for the entire statement (as opposed to once for each row).voidsuppress()Advise PostgreSQL to silently suppress the operation on this row.
-
Method Details
-
getNew
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
ResultSetcontaining one row ornull. - Throws:
SQLException- if the contained native buffer has gone stale.
-
getOld
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
ResultSetcontaining one row ornull. - Throws:
SQLException- if the contained native buffer has gone stale.
-
getArguments
Returns the arguments for this trigger (as declared in theCREATE TRIGGERstatement. 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
Returns the name of the trigger (as declared in theCREATE TRIGGERstatement).- Throws:
SQLException- if the contained native buffer has gone stale.
-
getTableName
Returns the name of the table for which this trigger was created (as declared in theCREATE TRIGGERstatement).- Throws:
SQLException- if the contained native buffer has gone stale.
-
getSchemaName
Returns the name of the schema of the table for which this trigger was created (as declared in theCREATE TRIGGERstatement).- Throws:
SQLException- if the contained native buffer has gone stale.
-
isFiredAfter
Returnstrueif 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
Returnstrueif 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
Returnstrueif 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
Returnstrueif 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
Returnstrueif this trigger was fired by aDELETE.- Throws:
SQLException- if the contained native buffer has gone stale.
-
isFiredByInsert
Returnstrueif this trigger was fired by anINSERT.- Throws:
SQLException- if the contained native buffer has gone stale.
-
isFiredByUpdate
Returnstrueif this trigger was fired by anUPDATE.- Throws:
SQLException- if the contained native buffer has gone stale.
-
suppress
Advise PostgreSQL to silently suppress the operation on this row.- Throws:
SQLException- if called in anAFTERor aSTATEMENTtrigger
-