org.postgresql.pljava.internal

Class TriggerData

Implemented Interfaces:
TriggerData

public class TriggerData
extends JavaWrapper
implements TriggerData

The TriggerData correspons to the internal PostgreSQL TriggerData.

Method Summary

protected void
_free(long pointer)
String[]
getArguments()
Returns the arguments for this trigger (as declared in the CREATE TRIGGER statement.
String
getName()
Returns the name of the trigger (as declared in the CREATE TRIGGER statement).
ResultSet
getNew()
Returns the ResultSet that represents the new row.
Tuple
getNewTuple()
Returns a Tuple reflecting the new version of the row, if the trigger was fired for an UPDATE, and null if it is for an INSERT or a DELETE.
ResultSet
getOld()
Returns the ResultSet that represents the old row.
Relation
getRelation()
Returns a descriptor for the Tuples exposed by this trigger.
String
getSchemaName()
String
getTableName()
long
getTriggerReturnTuple()
Commits the changes made on the ResultSet representing new and returns the native pointer of new tuple.
Tuple
getTriggerTuple()
Returns a Tuple reflecting the row for which the trigger was fired.
boolean
isFiredAfter()
Returns true if the trigger was fired after the statement or row action that it is associated with.
boolean
isFiredBefore()
Returns true if the trigger was fired before the statement or row action that it is associated with.
boolean
isFiredByDelete()
Returns true if this trigger was fired by a DELETE.
boolean
isFiredByInsert()
Returns true if this trigger was fired by an INSERT.
boolean
isFiredByUpdate()
Returns true if this trigger was fired by an UPDATE.
boolean
isFiredForEachRow()
Returns true if this trigger is fired once for each row (as opposed to once for the entire statement).
boolean
isFiredForStatement()
Returns true if this trigger is fired once for the entire statement (as opposed to once for each row).

Methods inherited from class org.postgresql.pljava.internal.JavaWrapper

_free, finalize, getNativePointer

Method Details

_free

protected void _free(long pointer)
Overrides:
_free in interface JavaWrapper

getArguments

public String[] getArguments()
            throws SQLException
Returns the arguments for this trigger (as declared in the CREATE TRIGGER statement. If the trigger has no arguments, this method will return an array with size 0.
Specified by:
getArguments in interface TriggerData

getName

public String getName()
            throws SQLException
Returns the name of the trigger (as declared in the CREATE TRIGGER statement).
Specified by:
getName in interface TriggerData

getNew

public ResultSet getNew()
            throws SQLException
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:
getNew in interface TriggerData
Returns:
An updateable ResultSet containing one row or null.

getNewTuple

public Tuple getNewTuple()
            throws SQLException
Returns a Tuple reflecting the new version of the row, if the trigger was fired for an UPDATE, and null if it is for an INSERT or a DELETE. This is what you have to return from the function if the event is an UPDATE and you don't want to replace this row by a different one or skip the operation.

getOld

public ResultSet getOld()
            throws SQLException
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:
getOld in interface TriggerData
Returns:
A read-only ResultSet containing one row or null.

getRelation

public Relation getRelation()
            throws SQLException
Returns a descriptor for the Tuples exposed by this trigger.

getSchemaName

public String getSchemaName()
            throws SQLException
Specified by:
getSchemaName in interface TriggerData

getTableName

public String getTableName()
            throws SQLException
Specified by:
getTableName in interface TriggerData

getTriggerReturnTuple

public long getTriggerReturnTuple()
            throws SQLException
Commits the changes made on the ResultSet representing new and 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.
Returns:
The modified tuple, or if no modifications have been made, the original tuple.

getTriggerTuple

public Tuple getTriggerTuple()
            throws SQLException
Returns a Tuple reflecting the row for which the trigger was fired. This is the row being inserted, updated, or deleted. If this trigger was fired for an INSERT or DELETE then 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 of INSERT ) or skip the operation.

isFiredAfter

public boolean isFiredAfter()
            throws SQLException
Returns true if the trigger was fired after the statement or row action that it is associated with.
Specified by:
isFiredAfter in interface TriggerData

isFiredBefore

public boolean isFiredBefore()
            throws SQLException
Returns true if the trigger was fired before the statement or row action that it is associated with.
Specified by:
isFiredBefore in interface TriggerData

isFiredByDelete

public boolean isFiredByDelete()
            throws SQLException
Returns true if this trigger was fired by a DELETE.
Specified by:
isFiredByDelete in interface TriggerData

isFiredByInsert

public boolean isFiredByInsert()
            throws SQLException
Returns true if this trigger was fired by an INSERT.
Specified by:
isFiredByInsert in interface TriggerData

isFiredByUpdate

public boolean isFiredByUpdate()
            throws SQLException
Returns true if this trigger was fired by an UPDATE.
Specified by:
isFiredByUpdate in interface TriggerData

isFiredForEachRow

public boolean isFiredForEachRow()
            throws SQLException
Returns true if this trigger is fired once for each row (as opposed to once for the entire statement).
Specified by:
isFiredForEachRow in interface TriggerData

isFiredForStatement

public boolean isFiredForStatement()
            throws SQLException
Returns true if this trigger is fired once for the entire statement (as opposed to once for each row).
Specified by:
isFiredForStatement in interface TriggerData

Copyright (c) 2003, 2004, 2005 TADA AB - Taby Sweden. \ Distributed under the terms shown in COPYRIGHT