Class GenericRIChecker
- java.lang.Object
-
- org.apache.derby.impl.sql.execute.GenericRIChecker
-
- Direct Known Subclasses:
ForeignKeyRIChecker,ReferencedKeyRIChecker
public abstract class GenericRIChecker extends java.lang.ObjectGeneric implementation of a Referential Integrity checker. Abstract.
-
-
Field Summary
Fields Modifier and Type Field Description protected BackingStoreHashtabledeferredRowsHashTableCached value (for efficiency) of the intermediate table of violations we use in the presence of deferred FK constraints.protected DynamicCompiledOpenConglomInfo[]fkDcocisprotected FKInfofkInfoprotected StaticCompiledOpenConglomInfo[]fkScocisprotected int[]identityMap(package private) IndexRowindexQualifierRowprotected LanguageConnectionContextlccprotected intnumColumnsprotected DynamicCompiledOpenConglomInforefDcociprotected StaticCompiledOpenConglomInforefScociprivate java.util.Hashtable<java.lang.Long,ScanController>scanControllersprotected TransactionControllertc
-
Constructor Summary
Constructors Constructor Description GenericRIChecker(LanguageConnectionContext lcc, TransactionController tc, FKInfo fkinfo)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) voidclose()Clean up all scan controllers(package private) abstract voiddoCheck(Activation a, ExecRow row, boolean restrictCheckOnly, int deferredRowReq)Check the validity of this row(package private) intgetRICheckIsolationLevel()Get the isolation level for the scan for the RI check.protected ScanControllergetScanController(long conglomNumber, StaticCompiledOpenConglomInfo scoci, DynamicCompiledOpenConglomInfo dcoci, ExecRow searchRow)Get a scan controller positioned using searchRow as the start/stop position.(package private) booleanisAnyFieldNull(ExecRow baseRow)Are any of the fields null in the row passed in.private voidsetupQualifierRow(ExecRow baseRow)
-
-
-
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
-
lcc
protected LanguageConnectionContext lcc
-
deferredRowsHashTable
protected BackingStoreHashtable deferredRowsHashTable
Cached value (for efficiency) of the intermediate table of violations we use in the presence of deferred FK constraints.
-
scanControllers
private final java.util.Hashtable<java.lang.Long,ScanController> scanControllers
-
numColumns
protected final int numColumns
-
identityMap
protected int[] identityMap
-
indexQualifierRow
final IndexRow indexQualifierRow
-
-
Constructor Detail
-
GenericRIChecker
GenericRIChecker(LanguageConnectionContext lcc, TransactionController tc, FKInfo fkinfo) throws StandardException
- Parameters:
lcc- the language connection contexttc- the xact controllerfkinfo- the foreign key information- Throws:
StandardException- Thrown on failure
-
-
Method Detail
-
doCheck
abstract void doCheck(Activation a, ExecRow row, boolean restrictCheckOnly, int deferredRowReq) throws StandardException
Check the validity of this row- Parameters:
a- The activationrow- The row to checkrestrictCheckOnly-trueif 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 ifpostCheck==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 inscoci-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:
trueif any are null
-
close
void close() throws StandardExceptionClean 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.
-
-