Class GenericRIChecker
- java.lang.Object
-
- org.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
Fields Modifier and Type Field Description protected BackingStoreHashtable
deferredRowsHashTable
Cached value (for efficiency) of the intermediate table of violations we use in the presence of deferred FK constraints.protected DynamicCompiledOpenConglomInfo[]
fkDcocis
protected FKInfo
fkInfo
protected StaticCompiledOpenConglomInfo[]
fkScocis
protected int[]
identityMap
(package private) IndexRow
indexQualifierRow
protected LanguageConnectionContext
lcc
protected int
numColumns
protected DynamicCompiledOpenConglomInfo
refDcoci
protected StaticCompiledOpenConglomInfo
refScoci
private java.util.Hashtable<java.lang.Long,ScanController>
scanControllers
protected TransactionController
tc
-
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) void
close()
Clean up all scan controllers(package private) abstract void
doCheck(Activation a, ExecRow row, boolean restrictCheckOnly, int deferredRowReq)
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)
-
-
-
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
-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 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:
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.
-
-