Class GenericRIChecker

java.lang.Object
org.apache.derby.impl.sql.execute.GenericRIChecker
Direct Known Subclasses:
ForeignKeyRIChecker, ReferencedKeyRIChecker

public abstract class GenericRIChecker extends Object
Generic implementation of a Referential Integrity checker. Abstract.
  • Field Details

  • Constructor Details

  • Method Details

    • doCheck

      abstract void doCheck(Activation a, ExecRow row, boolean restrictCheckOnly, int deferredRowReq) throws StandardException
      Check the validity of this row
      Parameters:
      a - The activation
      row - The row to check
      restrictCheckOnly - true if the check is relevant only for RESTRICTED referential action.
      deferredRowReq - For referenced keys: The required number of duplicates that need to be present. Only used if postCheck==false.
      Throws:
      StandardException - on error
    • getScanController

      protected ScanController getScanController(long conglomNumber, StaticCompiledOpenConglomInfo scoci, DynamicCompiledOpenConglomInfo dcoci, ExecRow searchRow) throws StandardException
      Get a scan controller positioned using searchRow as the start/stop position. The assumption is that searchRow is of the same format as the index being opened. The scan is set up to return no columns. NOTE: We only need an instantaneous lock on the table that we are probing as we are just checking for the existence of a row. All updaters, whether to the primary or foreign key tables, will hold an X lock on the table that they are updating and will be probing the other table, so instantaneous locks will not change the semantics. RESOLVE: Due to the current RI implementation we cannot always get instantaneous locks. We will call a method to find out what kind of locking to do until the implementation changes.
      Parameters:
      conglomNumber - the particular conglomerate we are interested in
      scoci -
      dcoci -
      searchRow - the row to match
      Returns:
      scan controller
      Throws:
      StandardException - on error
    • setupQualifierRow

      private void setupQualifierRow(ExecRow baseRow)
    • isAnyFieldNull

      boolean isAnyFieldNull(ExecRow baseRow)
      Are any of the fields null in the row passed in. The only fields that are checked are those corresponding to the colArray in fkInfo.
      Parameters:
      baseRow - the row to check for null fields
      Returns:
      true if any are null
    • close

      void close() throws StandardException
      Clean up all scan controllers
      Throws:
      StandardException - on error
    • getRICheckIsolationLevel

      int getRICheckIsolationLevel()
      Get the isolation level for the scan for the RI check. NOTE: The level will eventually be instantaneous locking once the implementation changes.
      Returns:
      The isolation level for the scan for the RI check.