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

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

public abstract class GenericRIChecker
extends java.lang.Object

Generic implementation of a Referential Integrity checker. Abstract.


Field Summary
protected  DynamicCompiledOpenConglomInfo[] fkDcocis
           
protected  FKInfo fkInfo
           
protected  StaticCompiledOpenConglomInfo[] fkScocis
           
private  IndexRow indexQualifierRow
           
private  int numColumns
           
protected  DynamicCompiledOpenConglomInfo refDcoci
           
protected  StaticCompiledOpenConglomInfo refScoci
           
private  java.util.Hashtable scanControllers
           
protected  TransactionController tc
           
 
Constructor Summary
(package private) GenericRIChecker(TransactionController tc, FKInfo fkinfo)
           
 
Method Summary
(package private)  void close()
          Clean up all scan controllers
 void doCheck(ExecRow row)
           
(package private) abstract  void doCheck(ExecRow row, boolean restrictCheckOnly)
          Check the validity of this row
(package private)  int getRICheckIsolationLevel()
          Get the isolation level for the scan for the RI check.
protected  ScanController getScanController(long conglomNumber, StaticCompiledOpenConglomInfo scoci, DynamicCompiledOpenConglomInfo dcoci, ExecRow searchRow)
          Get a scan controller positioned using searchRow as the start/stop position.
(package private)  boolean isAnyFieldNull(ExecRow baseRow)
          Are any of the fields null in the row passed in.
private  void setupQualifierRow(ExecRow baseRow)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fkInfo

protected FKInfo fkInfo

fkDcocis

protected DynamicCompiledOpenConglomInfo[] fkDcocis

fkScocis

protected StaticCompiledOpenConglomInfo[] fkScocis

refDcoci

protected DynamicCompiledOpenConglomInfo refDcoci

refScoci

protected StaticCompiledOpenConglomInfo refScoci

tc

protected TransactionController tc

scanControllers

private java.util.Hashtable scanControllers

numColumns

private int numColumns

indexQualifierRow

private IndexRow indexQualifierRow
Constructor Detail

GenericRIChecker

GenericRIChecker(TransactionController tc,
                 FKInfo fkinfo)
           throws StandardException
Parameters:
tc - the xact controller
Throws:
StandardException - Thrown on failure
Method Detail

doCheck

abstract void doCheck(ExecRow row,
                      boolean restrictCheckOnly)
               throws StandardException
Check the validity of this row

Parameters:
row - the row to check
Throws:
StandardException - on error

doCheck

public void doCheck(ExecRow row)
             throws StandardException
Throws:
StandardException

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 existance 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
searchRow - the row to match
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.


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 implemenation changes.

Returns:
The isolation level for the scan for the RI check.


Apache Derby V10.0 Engine Documentation - Copyright © 1997,2004 The Apache Software Foundation or its licensors, as applicable.