java.lang.Object
org.postgresql.pljava.internal.TriggerData
- All Implemented Interfaces:
TriggerData
The
TriggerData correspons to the internal PostgreSQL TriggerData.- 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.Returns aTuplereflecting the new version of the row, if the trigger was fired for anUPDATE, andnullif it is for anINSERTor aDELETE.getOld()Returns the ResultSet that represents the old row.Returns a descriptor for the Tuples exposed by this trigger.longCommits the changes made on theResultSetrepresentingnewand returns the native pointer of new tuple.Returns aTuplereflecting the row for which the trigger was fired.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()
-
Method Details
-
suppress
- Specified by:
suppressin interfaceTriggerData- Throws:
SQLException
-
getNew
Returns the ResultSet that represents the new row. This ResultSet will be null for delete triggers and for triggers that was fired for statement.
The returned set will be updateable and positioned on a valid row.- Specified by:
getNewin interfaceTriggerData- 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 was fired for statement.
The returned set will be read-only and positioned on a valid row.- Specified by:
getOldin interfaceTriggerData- Returns:
- A read-only
ResultSetcontaining one row ornull. - Throws:
SQLException- if the contained native buffer has gone stale.
-
getTriggerReturnTuple
Commits the changes made on theResultSetrepresentingnewand returns the native pointer of new tuple. This method is called automatically by the trigger handler and should not be called in any other way.Note: starting with PostgreSQL 10, this method can fail if SPI is not connected; it is the caller's responsibility in PG 10 and up to ensure that SPI is connected and that a longer-lived memory context than SPI's has been selected, if the caller wants the result of this call to survive
SPI_finish.- Returns:
- The modified tuple, or if no modifications have been made, the original tuple.
- Throws:
SQLException
-
getTableName
- Specified by:
getTableNamein interfaceTriggerData- Throws:
SQLException
-
getSchemaName
- Specified by:
getSchemaNamein interfaceTriggerData- Throws:
SQLException
-
getRelation
Returns a descriptor for the Tuples exposed by this trigger.- Throws:
SQLException- if the contained native buffer has gone stale.
-
getTriggerTuple
Returns aTuplereflecting the row for which the trigger was fired. This is the row being inserted, updated, or deleted. If this trigger was fired for anINSERTorDELETEthen this is what you should return to from the method if you don't want to replace the row with a different one (in the case ofINSERT) or skip the operation.- Throws:
SQLException- if the contained native buffer has gone stale.
-
getNewTuple
Returns aTuplereflecting the new version of the row, if the trigger was fired for anUPDATE, andnullif it is for anINSERTor aDELETE. This is what you have to return from the function if the event is anUPDATEand you don't want to replace this row by a different one or skip the operation.- 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.- Specified by:
getArgumentsin interfaceTriggerData- Throws:
SQLException- if the contained native buffer has gone stale.
-
getName
Returns the name of the trigger (as declared in theCREATE TRIGGERstatement).- Specified by:
getNamein interfaceTriggerData- 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.- Specified by:
isFiredAfterin interfaceTriggerData- 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.- Specified by:
isFiredBeforein interfaceTriggerData- 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).- Specified by:
isFiredForEachRowin interfaceTriggerData- 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).- Specified by:
isFiredForStatementin interfaceTriggerData- Throws:
SQLException- if the contained native buffer has gone stale.
-
isFiredByDelete
Returnstrueif this trigger was fired by aDELETE.- Specified by:
isFiredByDeletein interfaceTriggerData- Throws:
SQLException- if the contained native buffer has gone stale.
-
isFiredByInsert
Returnstrueif this trigger was fired by anINSERT.- Specified by:
isFiredByInsertin interfaceTriggerData- Throws:
SQLException- if the contained native buffer has gone stale.
-
isFiredByUpdate
Returnstrueif this trigger was fired by anUPDATE.- Specified by:
isFiredByUpdatein interfaceTriggerData- Throws:
SQLException- if the contained native buffer has gone stale.
-