org.postgresql.pljava.internal
Class TriggerData

java.lang.Object
  extended by org.postgresql.pljava.internal.JavaWrapper
      extended by org.postgresql.pljava.internal.TriggerData
All 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)
          Calls the C function pfree() with the given pointer as an argument.
 java.lang.String[] getArguments()
          Returns the arguments for this trigger (as declared in the CREATE TRIGGER statement.
 java.lang.String getName()
          Returns the name of the trigger (as declared in the CREATE TRIGGER statement).
 java.sql.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.
 java.sql.ResultSet getOld()
          Returns the ResultSet that represents the old row.
 Relation getRelation()
          Returns a descriptor for the Tuples exposed by this trigger.
 java.lang.String getTableName()
          Returns the name of the table for which this trigger was created (as declared in the CREATE TRIGGER
 Tuple getTriggerReturnTuple()
          Commits the changes made on the ResultSet representing new and returns the 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
finalize, getNativePointer
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getNew

public java.sql.ResultSet getNew()
                          throws java.sql.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.
Throws:
java.sql.SQLException - if the contained native buffer has gone stale.

getOld

public java.sql.ResultSet getOld()
                          throws java.sql.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.
Throws:
java.sql.SQLException - if the contained native buffer has gone stale.

getTriggerReturnTuple

public Tuple getTriggerReturnTuple()
                            throws java.sql.SQLException
Commits the changes made on the ResultSet representing new and returns the 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.
Throws:
java.sql.SQLException

getTableName

public java.lang.String getTableName()
                              throws java.sql.SQLException
Description copied from interface: TriggerData
Returns the name of the table for which this trigger was created (as declared in the CREATE TRIGGER
Specified by:
getTableName in interface TriggerData
Throws:
java.sql.SQLException - if the contained native buffer has gone stale.

getRelation

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

Throws:
java.sql.SQLException - if the contained native buffer has gone stale.

getTriggerTuple

public Tuple getTriggerTuple()
                      throws java.sql.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.

Throws:
java.sql.SQLException - if the contained native buffer has gone stale.

getNewTuple

public Tuple getNewTuple()
                  throws java.sql.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.

Throws:
java.sql.SQLException - if the contained native buffer has gone stale.

getArguments

public java.lang.String[] getArguments()
                                throws java.sql.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
Throws:
java.sql.SQLException - if the contained native buffer has gone stale.

getName

public java.lang.String getName()
                         throws java.sql.SQLException
Returns the name of the trigger (as declared in the CREATE TRIGGER statement).

Specified by:
getName in interface TriggerData
Throws:
java.sql.SQLException - if the contained native buffer has gone stale.

isFiredAfter

public boolean isFiredAfter()
                     throws java.sql.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
Throws:
java.sql.SQLException - if the contained native buffer has gone stale.

isFiredBefore

public boolean isFiredBefore()
                      throws java.sql.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
Throws:
java.sql.SQLException - if the contained native buffer has gone stale.

isFiredForEachRow

public boolean isFiredForEachRow()
                          throws java.sql.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
Throws:
java.sql.SQLException - if the contained native buffer has gone stale.

isFiredForStatement

public boolean isFiredForStatement()
                            throws java.sql.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
Throws:
java.sql.SQLException - if the contained native buffer has gone stale.

isFiredByDelete

public boolean isFiredByDelete()
                        throws java.sql.SQLException
Returns true if this trigger was fired by a DELETE.

Specified by:
isFiredByDelete in interface TriggerData
Throws:
java.sql.SQLException - if the contained native buffer has gone stale.

isFiredByInsert

public boolean isFiredByInsert()
                        throws java.sql.SQLException
Returns true if this trigger was fired by an INSERT.

Specified by:
isFiredByInsert in interface TriggerData
Throws:
java.sql.SQLException - if the contained native buffer has gone stale.

isFiredByUpdate

public boolean isFiredByUpdate()
                        throws java.sql.SQLException
Returns true if this trigger was fired by an UPDATE.

Specified by:
isFiredByUpdate in interface TriggerData
Throws:
java.sql.SQLException - if the contained native buffer has gone stale.

_free

protected void _free(long pointer)
Description copied from class: JavaWrapper
Calls the C function pfree() with the given pointer as an argument. Subclasses may override this method if special handling is needed when freeing up the object.

Overrides:
_free in class JavaWrapper
Parameters:
pointer - The pointer to free.


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