public class RIBulkChecker
extends java.lang.Object
The comparision is done via a merge. Consequently, it is imperative that the scans are on keyed conglomerates (indexes) and that the referencedKeyScan is a unique scan.
Performance is no worse than N + M where N is foreign key rows and M is primary key rows.
Bulk fetch is used to further speed performance. The fetch size is LanguageProperties.BULK_FETCH_DEFAULT
LanguageProperties
Modifier and Type | Field and Description |
---|---|
private UUID |
constraintId |
private int |
currFKRowIndex |
private int |
currRefRowIndex |
private boolean |
deferred |
private BackingStoreHashtable |
deferredRowsHashTable |
private static int |
EQUAL |
private int |
failedCounter |
private ExecRow |
firstRowToFail |
private long |
fkCID |
private DataValueDescriptor[][] |
foreignKeyRowArray |
private GroupFetchScanController |
foreignKeyScan |
private static int |
GREATER_THAN |
private int |
lastFKRowIndex |
private int |
lastRefRowIndex |
private LanguageConnectionContext |
lcc |
private static int |
LESS_THAN |
private int |
numColumns |
private long |
pkCID |
private boolean |
quitOnFirstFailure |
private DataValueDescriptor[][] |
referencedKeyRowArray |
private GroupFetchScanController |
referencedKeyScan |
private java.lang.String |
schemaName |
private java.lang.String |
tableName |
private ConglomerateController |
unreferencedCC |
Constructor and Description |
---|
RIBulkChecker(Activation a,
GroupFetchScanController referencedKeyScan,
GroupFetchScanController foreignKeyScan,
ExecRow templateRow,
boolean quitOnFirstFailure,
ConglomerateController unreferencedCC,
ExecRow firstRowToFail,
java.lang.String schemaName,
java.lang.String tableName,
UUID constraintId,
boolean deferrable,
long fkCID,
long pkCID)
Create a RIBulkChecker
|
Modifier and Type | Method and Description |
---|---|
private boolean |
anyNull(DataValueDescriptor[] fkRowArray) |
int |
doCheck()
Perform the check.
|
private void |
failure(DataValueDescriptor[] foreignKeyRow) |
private DataValueDescriptor[] |
getNextFK() |
private DataValueDescriptor[] |
getNextRef() |
private int |
greaterThan(DataValueDescriptor[] fkRowArray,
DataValueDescriptor[] refRowArray) |
private static final int EQUAL
private static final int GREATER_THAN
private static final int LESS_THAN
private final long fkCID
private final long pkCID
private final java.lang.String schemaName
private final java.lang.String tableName
private final UUID constraintId
private BackingStoreHashtable deferredRowsHashTable
private final LanguageConnectionContext lcc
private final boolean deferred
private GroupFetchScanController referencedKeyScan
private DataValueDescriptor[][] referencedKeyRowArray
private GroupFetchScanController foreignKeyScan
private DataValueDescriptor[][] foreignKeyRowArray
private ConglomerateController unreferencedCC
private int failedCounter
private boolean quitOnFirstFailure
private int numColumns
private int currRefRowIndex
private int currFKRowIndex
private int lastRefRowIndex
private int lastFKRowIndex
private ExecRow firstRowToFail
public RIBulkChecker(Activation a, GroupFetchScanController referencedKeyScan, GroupFetchScanController foreignKeyScan, ExecRow templateRow, boolean quitOnFirstFailure, ConglomerateController unreferencedCC, ExecRow firstRowToFail, java.lang.String schemaName, java.lang.String tableName, UUID constraintId, boolean deferrable, long fkCID, long pkCID) throws StandardException
a
- the activationreferencedKeyScan
- scan of the referenced key's
backing index. must be uniqueforeignKeyScan
- scan of the foreign key's
backing indextemplateRow
- a template row for the indexes.
Will be cloned when it is used.
Must be a full index row.quitOnFirstFailure
- quit on first unreferenced keyunreferencedCC
- put unreferenced keys herefirstRowToFail
- the first row that fails the constraint
is copied to this, if non-nullschemaName
- schema name of the table we insert intotableName
- table name of the table we insert intoconstraintId
- constraint id of the foreign constraintdeferrable
- true
if the constraint is deferrablefkCID
- conglomerate id of the foreign key
supporting indexpkCID
- conglomerate id of the referenced primary
key or unique index.StandardException
public int doCheck() throws StandardException
StandardException
- on errorprivate DataValueDescriptor[] getNextFK() throws StandardException
StandardException
private DataValueDescriptor[] getNextRef() throws StandardException
StandardException
private void failure(DataValueDescriptor[] foreignKeyRow) throws StandardException
StandardException
private boolean anyNull(DataValueDescriptor[] fkRowArray) throws StandardException
StandardException
private int greaterThan(DataValueDescriptor[] fkRowArray, DataValueDescriptor[] refRowArray) throws StandardException
StandardException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.