Class GenericRIChecker
java.lang.Object
org.apache.derby.impl.sql.execute.GenericRIChecker
- Direct Known Subclasses:
ForeignKeyRIChecker
,ReferencedKeyRIChecker
Generic implementation of a Referential Integrity
checker. Abstract.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BackingStoreHashtable
Cached value (for efficiency) of the intermediate table of violations we use in the presence of deferred FK constraints.protected DynamicCompiledOpenConglomInfo[]
protected FKInfo
protected StaticCompiledOpenConglomInfo[]
protected int[]
(package private) final IndexRow
protected LanguageConnectionContext
protected final int
protected DynamicCompiledOpenConglomInfo
protected StaticCompiledOpenConglomInfo
private final Hashtable
<Long, ScanController> protected TransactionController
-
Constructor Summary
ConstructorsConstructorDescriptionGenericRIChecker
(LanguageConnectionContext lcc, TransactionController tc, FKInfo fkinfo) -
Method Summary
Modifier and TypeMethodDescription(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
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 Details
-
fkInfo
-
fkDcocis
-
fkScocis
-
refDcoci
-
refScoci
-
tc
-
lcc
-
deferredRowsHashTable
Cached value (for efficiency) of the intermediate table of violations we use in the presence of deferred FK constraints. -
scanControllers
-
numColumns
protected final int numColumns -
identityMap
protected int[] identityMap -
indexQualifierRow
-
-
Constructor Details
-
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 Details
-
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
-
isAnyFieldNull
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
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.
-