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 final UUID | |
| private int | |
| private int | |
| private final boolean | |
| private BackingStoreHashtable | |
| private static final int | |
| private int | |
| private ExecRow | |
| private final long | |
| private DataValueDescriptor[][] | |
| private GroupFetchScanController | |
| private static final int | |
| private int | |
| private int | |
| private final LanguageConnectionContext | |
| private static final int | |
| private int | |
| private final long | |
| private boolean | |
| private DataValueDescriptor[][] | |
| private GroupFetchScanController | |
| private final String | |
| private final String | |
| private ConglomerateController |
| Access | Constructor and Description |
|---|---|
| public | RIBulkChecker(Activation
the activation a, GroupFetchScanController scan of the referenced key's
backing index. must be unique referencedKeyScan, GroupFetchScanController scan of the foreign key's
backing index foreignKeyScan, ExecRow a template row for the indexes.
Will be cloned when it is used.
Must be a full index row. templateRow, boolean quit on first unreferenced key quitOnFirstFailure, ConglomerateController put unreferenced keys here unreferencedCC, ExecRow the first row that fails the constraint
is copied to this, if non-null firstRowToFail, String schema name of the table we insert into schemaName, String table name of the table we insert into tableName, UUID constraint id of the foreign constraint constraintId, boolean true if the constraint is deferrableconglomerate id of the foreign key
supporting index fkCID, long conglomerate id of the referenced primary
key or unique index. pkCID)Create a RIBulkChecker |
| Modifier and Type | Method and Description |
|---|---|
| private boolean | |
| public int | |
| private void | |
| private DataValueDescriptor[] | |
| private DataValueDescriptor[] | |
| private int |
| constraintId | back to summary |
|---|---|
| private final UUID constraintId | |
| currFKRowIndex | back to summary |
|---|---|
| private int currFKRowIndex | |
| currRefRowIndex | back to summary |
|---|---|
| private int currRefRowIndex | |
| deferred | back to summary |
|---|---|
| private final boolean deferred | |
| deferredRowsHashTable | back to summary |
|---|---|
| private BackingStoreHashtable deferredRowsHashTable | |
| EQUAL | back to summary |
|---|---|
| private static final int EQUAL | |
| failedCounter | back to summary |
|---|---|
| private int failedCounter | |
| firstRowToFail | back to summary |
|---|---|
| private ExecRow firstRowToFail | |
| fkCID | back to summary |
|---|---|
| private final long fkCID | |
| foreignKeyRowArray | back to summary |
|---|---|
| private DataValueDescriptor[][] foreignKeyRowArray | |
| foreignKeyScan | back to summary |
|---|---|
| private GroupFetchScanController foreignKeyScan | |
| GREATER_THAN | back to summary |
|---|---|
| private static final int GREATER_THAN | |
| lastFKRowIndex | back to summary |
|---|---|
| private int lastFKRowIndex | |
| lastRefRowIndex | back to summary |
|---|---|
| private int lastRefRowIndex | |
| lcc | back to summary |
|---|---|
| private final LanguageConnectionContext lcc | |
| LESS_THAN | back to summary |
|---|---|
| private static final int LESS_THAN | |
| numColumns | back to summary |
|---|---|
| private int numColumns | |
| pkCID | back to summary |
|---|---|
| private final long pkCID | |
| quitOnFirstFailure | back to summary |
|---|---|
| private boolean quitOnFirstFailure | |
| referencedKeyRowArray | back to summary |
|---|---|
| private DataValueDescriptor[][] referencedKeyRowArray | |
| referencedKeyScan | back to summary |
|---|---|
| private GroupFetchScanController referencedKeyScan | |
| schemaName | back to summary |
|---|---|
| private final String schemaName | |
| tableName | back to summary |
|---|---|
| private final String tableName | |
| unreferencedCC | back to summary |
|---|---|
| private ConglomerateController unreferencedCC | |
| RIBulkChecker | back to summary |
|---|---|
| public RIBulkChecker(Activation a, GroupFetchScanController referencedKeyScan, GroupFetchScanController foreignKeyScan, ExecRow templateRow, boolean quitOnFirstFailure, ConglomerateController unreferencedCC, ExecRow firstRowToFail, String schemaName, String tableName, UUID constraintId, boolean deferrable, long fkCID, long pkCID) throws StandardException Create a RIBulkChecker
| |
| anyNull | back to summary |
|---|---|
| private boolean anyNull(DataValueDescriptor[] fkRowArray) throws StandardException | |
| doCheck | back to summary |
|---|---|
| public int doCheck() throws StandardException Perform the check. If deferred constraint mode, the numbers of failed rows returned will be always be 0 (but any violating keys will have been saved for later checking).
| |
| failure | back to summary |
|---|---|
| private void failure(DataValueDescriptor[] foreignKeyRow) throws StandardException | |
| getNextFK | back to summary |
|---|---|
| private DataValueDescriptor[] getNextFK() throws StandardException | |
| getNextRef | back to summary |
|---|---|
| private DataValueDescriptor[] getNextRef() throws StandardException | |
| greaterThan | back to summary |
|---|---|
| private int greaterThan(DataValueDescriptor[] fkRowArray, DataValueDescriptor[] refRowArray) throws StandardException | |