public class ReferencedKeyRIChecker extends GenericRIChecker
Modifier and Type | Field and Description |
---|---|
private BackingStoreHashtable |
deletedKeys
We save away keys with a counter in this hash table, so we know how many
instances of a key (duplicates) have been deleted/modified, cf usage
in
postCheck() . |
private DataValueDescriptor[] |
refKey
Key mapping used when storing referenced (PK, unique) keys under
deferred row processing and deferred key constraint (PK, unique).
|
private ScanController |
refKeyIndexScan |
deferredRowsHashTable, fkDcocis, fkInfo, fkScocis, identityMap, indexQualifierRow, lcc, numColumns, refDcoci, refScoci, tc
Constructor and Description |
---|
ReferencedKeyRIChecker(LanguageConnectionContext lcc,
TransactionController tc,
FKInfo fkinfo) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
close()
Clean up all scan controllers and other resources
|
(package private) void |
doCheck(Activation a,
ExecRow row,
boolean restrictCheckOnly,
int deferredRowReq)
Check that the row either has a null column(s), or
has no corresponding foreign keys.
|
private boolean |
isDuplicated(DataValueDescriptor[] key,
long deferredRowReq) |
private boolean |
isDuplicated(ExecRow row,
int deferredRowReq) |
void |
postCheck()
Check that we have at least one more row in the referenced
table table containing a key than the number of projected deletes of that
key.
|
private void |
rememberKey(ExecRow rememberRow)
Remember the deletion of this key, it may cause a RESTRICT
foreign key violation, cf. logic in @{link #postCheck}.
|
getRICheckIsolationLevel, getScanController, isAnyFieldNull
private ScanController refKeyIndexScan
private final DataValueDescriptor[] refKey
private BackingStoreHashtable deletedKeys
postCheck()
. Initialized on demand.ReferencedKeyRIChecker(LanguageConnectionContext lcc, TransactionController tc, FKInfo fkinfo) throws StandardException
lcc
- the language connection contexttc
- the xact controllerfkinfo
- the foreign key informationStandardException
- Thrown on failurevoid doCheck(Activation a, ExecRow row, boolean restrictCheckOnly, int deferredRowReq) throws StandardException
If a foreign key is found, an exception is thrown. If not, the scan is closed.
doCheck
in class GenericRIChecker
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 if postCheck==false
.StandardException
- on unexpected error, or
on a primary/unique key violationprivate void rememberKey(ExecRow rememberRow) throws StandardException
rememberRow
- StandardException
public void postCheck() throws StandardException
StandardException
- Standard error policyprivate boolean isDuplicated(ExecRow row, int deferredRowReq) throws StandardException
StandardException
private boolean isDuplicated(DataValueDescriptor[] key, long deferredRowReq) throws StandardException
StandardException
void close() throws StandardException
close
in class GenericRIChecker
StandardException
- on errorApache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.