Class DDUtils


  • public class DDUtils
    extends java.lang.Object
    Static Data dictionary utilities.
    Version:
    0.1
    • Constructor Detail

      • DDUtils

        public DDUtils()
    • Method Detail

      • getCurrentDeleteConnections

        private static int getCurrentDeleteConnections​(DataDictionary dd,
                                                       TableDescriptor td,
                                                       int refActionType,
                                                       java.util.Hashtable<java.lang.String,​java.lang.Integer> dch,
                                                       boolean prevNotCascade,
                                                       boolean findSelfRef)
                                                throws StandardException
        Finds the existing delete connection for the table and the referential actions that will occur and stores the information in the hash table. HashTable (key , value) = ( table name that this table is delete connected to, referential action that will occur if there is a delete on the table this table connected to [CASCADE, SET NULL, RESTRICT, NO ACTION] )
        Throws:
        StandardException
      • validateDeleteConnection

        private static void validateDeleteConnection​(DataDictionary dd,
                                                     TableDescriptor actualTd,
                                                     TableDescriptor refTd,
                                                     int refActionType,
                                                     java.util.Hashtable<java.lang.String,​java.lang.Integer> dch,
                                                     java.util.Hashtable<java.lang.String,​java.lang.Integer> ech,
                                                     boolean checkImmediateRefTable,
                                                     java.lang.String myConstraintName,
                                                     boolean prevNotCascade,
                                                     java.lang.StringBuffer cycleString,
                                                     java.lang.String currentRefTableName,
                                                     boolean isSelfReferencingFk,
                                                     int currentSelfRefValue)
                                              throws StandardException
        The following function validates whether the new foreign key relationship violates any restriction on the referential actions. The current refAction implementation does not allow cases where we can possible land up having multiple action for the same row in a table. This could happen because the user can possibly define different actions through multiple foreign key paths. The following function throws an error while creating foreign keys if the new releationship leads to any such conditions. NOTE: The SQL99 standard also does not clearly says what we are supposed to do in these cases. Our implementation just follows what is done in DB2 and throws error messaged similar to DB2 (sql0632N, sql0633N, sql0634N).
        Throws:
        StandardException
      • checkForMultiplePathInvalidCases

        private static void checkForMultiplePathInvalidCases​(int currentRefAction,
                                                             int refActionType,
                                                             java.lang.String myConstraintName,
                                                             java.lang.String currentRefTableName)
                                                      throws StandardException
        Throws:
        StandardException
      • checkForAnyExistingDeleteConnectionViolations

        private static void checkForAnyExistingDeleteConnectionViolations​(DataDictionary dd,
                                                                          TableDescriptor td,
                                                                          int refActionType,
                                                                          java.util.Hashtable<java.lang.String,​java.lang.Integer> newDconnHashTable,
                                                                          java.lang.String myConstraintName)
                                                                   throws StandardException
        Throws:
        StandardException
      • generateError

        private static StandardException generateError​(java.lang.String messageId,
                                                       java.lang.String myConstraintName)
      • generateError

        private static StandardException generateError​(java.lang.String messageId,
                                                       java.lang.String myConstraintName,
                                                       int raRule)
      • generateError

        private static StandardException generateError​(java.lang.String messageId,
                                                       java.lang.String myConstraintName,
                                                       java.lang.String refTableName)