Class ConstraintConstantAction

    • Field Detail

      • constraintName

        protected java.lang.String constraintName
      • constraintType

        protected int constraintType
      • tableName

        protected java.lang.String tableName
      • schemaName

        protected java.lang.String schemaName
      • schemaId

        protected UUID schemaId
      • constraintId

        protected UUID constraintId
    • Constructor Detail

      • ConstraintConstantAction

        ConstraintConstantAction​(java.lang.String constraintName,
                                 int constraintType,
                                 java.lang.String tableName,
                                 UUID tableId,
                                 java.lang.String schemaName,
                                 IndexConstantAction indexAction)
        Make one of these puppies.
        Parameters:
        constraintName - Constraint name.
        constraintType - Constraint type.
        tableName - Table name.
        tableId - UUID of table.
        schemaName - schema that table and constraint lives in.
        indexAction - IndexConstantAction for constraint (if necessary) RESOLVE - the next parameter should go away once we use UUIDs (Generated constraint names will be based off of uuids)
    • Method Detail

      • getConstraintType

        public int getConstraintType()
        Get the constraint type.
        Returns:
        The constraint type
      • getConstraintName

        public java.lang.String getConstraintName()
        Get the constraint name
        Returns:
        the constraint name
      • getConstraintId

        public UUID getConstraintId()
        Get the constraint id of the constraint
        Returns:
        constraint id
      • getIndexAction

        public IndexConstantAction getIndexAction()
        Get the associated index constant action.
        Returns:
        the constant action for the backing index
      • validateConstraint

        static boolean validateConstraint​(java.lang.String constraintName,
                                          java.lang.String constraintText,
                                          UUID constraintId,
                                          TableDescriptor td,
                                          LanguageConnectionContext lcc,
                                          boolean isCheckConstraint,
                                          boolean isInitiallyDeferred)
                                   throws StandardException
        Evaluate a check constraint or not null column constraint. Generate a query of the form SELECT COUNT(*) FROM t where NOT() and run it by compiling and executing it. Will work ok if the table is empty and query returns null.
        Parameters:
        constraintName - constraint name
        constraintText - constraint text
        constraintId - constraint id
        td - referenced table
        lcc - the language connection context
        isCheckConstraint - the constraint is a check constraint
        isInitiallyDeferred - true if the constraint is initially deferred
        Returns:
        true if null constraint passes, false otherwise
        Throws:
        StandardException - if check constraint fails