Class FKInfo

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, Formatable, 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.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      FKInfo()
      Niladic constructor for Formattable
      FKInfo​(java.lang.String[] fkConstraintNames, java.lang.String schemaName, java.lang.String tableName, int stmtType, int type, UUID refUUID, long refConglomNumber, UUID refConstraintID, boolean refConstraintIsDeferrable, UUID[] fkUUIDs, long[] fkConglomNumbers, boolean[] fkIsSelfReferencing, int[] colArray, RowLocation rowLocation, int[] raRules, boolean[] deferrable, UUID[] fkIds)
      Constructor for FKInfo
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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, between 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
      • schemaName

        java.lang.String schemaName
      • tableName

        java.lang.String tableName
      • type

        int type
      • refUUID

        UUID refUUID
      • refConglomNumber

        long refConglomNumber
      • refConstraintID

        UUID refConstraintID
      • refConstraintIsDeferrable

        boolean refConstraintIsDeferrable
      • stmtType

        int stmtType
      • fkConstraintNames

        java.lang.String[] fkConstraintNames
      • fkUUIDs

        private UUID[] fkUUIDs
      • fkConglomNumbers

        long[] fkConglomNumbers
      • fkIds

        UUID[] fkIds
      • fkIsSelfReferencing

        boolean[] fkIsSelfReferencing
      • colArray

        int[] colArray
      • raRules

        int[] raRules
      • deferrable

        boolean[] deferrable
    • Constructor Detail

      • FKInfo

        public FKInfo()
        Niladic constructor for Formattable
      • FKInfo

        public FKInfo​(java.lang.String[] fkConstraintNames,
                      java.lang.String schemaName,
                      java.lang.String tableName,
                      int stmtType,
                      int type,
                      UUID refUUID,
                      long refConglomNumber,
                      UUID refConstraintID,
                      boolean refConstraintIsDeferrable,
                      UUID[] fkUUIDs,
                      long[] fkConglomNumbers,
                      boolean[] fkIsSelfReferencing,
                      int[] colArray,
                      RowLocation rowLocation,
                      int[] raRules,
                      boolean[] deferrable,
                      UUID[] fkIds)
        Constructor for FKInfo
        Parameters:
        fkConstraintNames - the foreign key constraint names
        schemaName - the name of the schema of the table being modified
        tableName - the name of the table being modified
        stmtType - the type of the statement: e.g. StatementType.INSERT
        type - either FKInfo.REFERENCED_KEY or FKInfo.FOREIGN_KEY
        refUUID - UUID of the referenced constraint's supporting index
        refConglomNumber - conglomerate number of the referenced key
        refConstraintID - UUID of the referenced constraint
        refConstraintIsDeferrable - true iff the referenced key constraint is deferrable
        fkUUIDs - an array of fkUUIDs of backing indexes. if FOREIGN_KEY, then just one element, the backing index of the referenced keys. if REFERENCED_KEY, then all the foreign keys
        fkConglomNumbers - array of conglomerate numbers, corresponds to fkUUIDs
        fkIsSelfReferencing - array of conglomerate booleans indicating whether the foreign key references a key in the same table
        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()
        raRules - referential action rules
        deferrable - the corresponding constraint is deferrable
        fkIds - the foreign key constraints' uuids.
    • 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 == FOREIGN_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()
        Overrides:
        toString in class java.lang.Object