org.apache.derby.impl.sql.execute
Class TriggerInfo

java.lang.Object
  extended byorg.apache.derby.impl.sql.execute.TriggerInfo
All Implemented Interfaces:
java.io.Externalizable, Formatable, java.io.Serializable, TypedFormat

public class TriggerInfo
extends java.lang.Object
implements Formatable

This is a simple class used to store the run time information about a foreign key. Used by DML to figure out what to check.

Author:
jamie
See Also:
Serialized Form

Field Summary
 int[] columnIds
           
 java.lang.String[] columnNames
           
 TriggerDescriptor[] triggerArray
          This class implements Formatable.
 
Constructor Summary
  TriggerInfo()
          Niladic constructor for Formattable
  TriggerInfo(TableDescriptor td, int[] changedCols, GenericDescriptorList triggers)
          Constructor for TriggerInfo
private TriggerInfo(TriggerDescriptor[] triggers, int[] changedColsIds, java.lang.String[] changedColsNames)
           
 
Method Summary
(package private)  TriggerDescriptor[] getTriggerArray()
           
 int getTypeFormatId()
          Get the formatID which corresponds to this class.
(package private)  boolean hasTrigger(boolean isBefore, boolean isRow)
          Do we have a trigger or triggers that meet the criteria
private  boolean hasTrigger(java.lang.Boolean isBefore, java.lang.Boolean isRow)
          Do we have a trigger or triggers that meet the criteria
 void readExternal(java.io.ObjectInput in)
          Read this object from a stream of stored objects.
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
          Write this object out
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

triggerArray

public TriggerDescriptor[] triggerArray
This class implements Formatable. That means that it can write itself to and from a formatted stream. If you add more fields to this class, make sure that you also write/read them with the writeExternal()/readExternal() methods. If, inbetween releases, you add more fields to this class, then you should bump the version number emitted by the getTypeFormatId() method. OR, since this is something that is used in stored prepared statements, it is ok to change it if you make sure that stored prepared statements are invalidated across releases.


columnNames

public java.lang.String[] columnNames

columnIds

public int[] columnIds
Constructor Detail

TriggerInfo

public TriggerInfo()
Niladic constructor for Formattable


TriggerInfo

public TriggerInfo(TableDescriptor td,
                   int[] changedCols,
                   GenericDescriptorList triggers)
            throws StandardException
Constructor for TriggerInfo

Parameters:
td - the table upon which the trigger is declared
changedCols - the columns that are changed in the dml that is causing the trigger to fire
triggers - the list of trigger descriptors
Throws:
StandardException - on error

TriggerInfo

private TriggerInfo(TriggerDescriptor[] triggers,
                    int[] changedColsIds,
                    java.lang.String[] changedColsNames)
Method Detail

hasTrigger

boolean hasTrigger(boolean isBefore,
                   boolean isRow)
Do we have a trigger or triggers that meet the criteria

Parameters:
isBefore - true for a before trigger, false for after trigger, null for either
isRow - true for a row trigger, false for statement trigger, null for either
Returns:
true if we have a trigger that meets the criteria

hasTrigger

private boolean hasTrigger(java.lang.Boolean isBefore,
                           java.lang.Boolean isRow)
Do we have a trigger or triggers that meet the criteria

Parameters:
isBefore - true for a before trigger, false for after trigger, null for either
isRow - true for a row trigger, false for statement trigger, null for either
Returns:
true if we have a trigger that meets the criteria

getTriggerArray

TriggerDescriptor[] getTriggerArray()

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Write this object out

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - write bytes here
Throws:
java.io.IOException - thrown on error

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Read this object from a stream of stored objects.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - read this.
Throws:
java.io.IOException - thrown on error
java.lang.ClassNotFoundException - thrown on error

getTypeFormatId

public int getTypeFormatId()
Get the formatID which corresponds to this class.

Specified by:
getTypeFormatId in interface TypedFormat
Returns:
the formatID of this class

toString

public java.lang.String toString()

Built on Tue 2006-10-10 19:23:47+0200, from revision exported

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.