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

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

public class FKInfo
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[] colArray
           
 long[] fkConglomNumbers
           
 java.lang.String[] fkConstraintNames
           
 boolean[] fkIsSelfReferencing
           
 UUID[] fkUUIDs
           
static int FOREIGN_KEY
          This class implements Formatable.
 int[] raRules
           
 long refConglomNumber
           
static int REFERENCED_KEY
           
 UUID refUUID
           
 RowLocation rowLocation
           
 int stmtType
           
 java.lang.String tableName
           
 int type
           
 
Constructor Summary
FKInfo()
          Niladic constructor for Formattable
FKInfo(java.lang.String[] fkConstraintNames, java.lang.String tableName, int stmtType, int type, UUID refUUID, long refConglomNumber, UUID[] fkUUIDs, long[] fkConglomNumbers, boolean[] fkIsSelfReferencing, int[] colArray, RowLocation rowLocation, int[] raRules)
          Consructor for FKInfo
 
Method Summary
static FKInfo[] chooseRelevantFKInfos(FKInfo[] fkInfo, int[] cols, boolean addAllTypeIsFK)
          Comb through the FKInfo structures and pick out the ones that have columns that intersect with the input columns.
 int getTypeFormatId()
          Get the formatID which corresponds to this class.
 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

FOREIGN_KEY

public static final int FOREIGN_KEY
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.

See Also:
Constant Field Values

REFERENCED_KEY

public static final int REFERENCED_KEY
See Also:
Constant Field Values

fkConstraintNames

public java.lang.String[] fkConstraintNames

tableName

public java.lang.String tableName

type

public int type

refUUID

public UUID refUUID

refConglomNumber

public long refConglomNumber

fkUUIDs

public UUID[] fkUUIDs

fkConglomNumbers

public long[] fkConglomNumbers

fkIsSelfReferencing

public boolean[] fkIsSelfReferencing

colArray

public int[] colArray

stmtType

public int stmtType

rowLocation

public RowLocation rowLocation

raRules

public int[] raRules
Constructor Detail

FKInfo

public FKInfo()
Niladic constructor for Formattable


FKInfo

public FKInfo(java.lang.String[] fkConstraintNames,
              java.lang.String tableName,
              int stmtType,
              int type,
              UUID refUUID,
              long refConglomNumber,
              UUID[] fkUUIDs,
              long[] fkConglomNumbers,
              boolean[] fkIsSelfReferencing,
              int[] colArray,
              RowLocation rowLocation,
              int[] raRules)
Consructor for FKInfo

Parameters:
fkConstraintNames - the foreign key constraint names
tableName - the name of the table being modified
type - either FKInfo.REFERENCED_KEY or FKInfo.FOREIGN_KEY
refUUID - UUID of the referenced constraint
fkUUIDs - an array of fkUUIDs of backing indexes. if FOREIGN_KEY, then just one element, the backing index of the referrenced keys. if REFERENCED_KEY, then all the foreign keys
fkConglomNumbers - array of conglomerate numbers, corresponds to fkUUIDs
colArray - map of columns to the base row that DML is changing. 1 based. Note that this maps the constraint index to a row in the target table of the current dml operation.
rowLocation - a row location template for the target table used to pass in a template row to tc.openScan()
Method Detail

chooseRelevantFKInfos

public static FKInfo[] chooseRelevantFKInfos(FKInfo[] fkInfo,
                                             int[] cols,
                                             boolean addAllTypeIsFK)
Comb through the FKInfo structures and pick out the ones that have columns that intersect with the input columns.

Parameters:
fkInfo - array of fkinfos
cols - array of columns
addAllTypeIsFK - take all with type == FORIEGN_KEY
Returns:
array of relevant fkinfos

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.