public final class DeferredConstraintsMemory
extends java.lang.Object
The approach taken in Derby to support deferred constraints is to make a note when the violation happens (at insert or update time), and then remember that violation until the mode switches back as described above. We note exactly which rows cause violations, so checking can happen as quickly as possible when we get there. The core mechanism used to remember the violations as well as the deferred checking is embodied in this class.
Modifier and Type | Class and Description |
---|---|
static class |
DeferredConstraintsMemory.CheckInfo
Info needed for check constraints
|
private static class |
DeferredConstraintsMemory.ForeignKeyInfo |
private static class |
DeferredConstraintsMemory.UniquePkInfo
Info needed for unique and primary key constraints
|
static class |
DeferredConstraintsMemory.ValidationInfo
Class hierarchy carrying the information we need to validate
some deferred constraint.
|
Constructor and Description |
---|
DeferredConstraintsMemory() |
Modifier and Type | Method and Description |
---|---|
static void |
compressOrTruncate(LanguageConnectionContext lcc,
UUID tableId,
java.lang.String tableName) |
static java.util.Enumeration<java.lang.Object> |
getDeferredCheckConstraintLocations(Activation activation,
UUID validatingBaseTableUUID) |
private static BackingStoreHashtable |
makeDeferredHashTable(TransactionController tc,
int cols) |
static BackingStoreHashtable |
rememberCheckViolations(LanguageConnectionContext lcc,
UUID basetableId,
java.lang.String schemaName,
java.lang.String tableName,
BackingStoreHashtable deferredCheckViolations,
java.util.List<UUID> violatingCheckConstraints,
RowLocation offendingRow,
DeferredConstraintsMemory.CheckInfo[] result)
Save the row location of an offending row (one or more check constraints
were violated) in a hash table (which may spill to disk) for later
checking, typically on transaction commit, or upon request.
|
static BackingStoreHashtable |
rememberDuplicate(LanguageConnectionContext lcc,
BackingStoreHashtable deferredRowsHashTable,
UUID constraintId,
DataValueDescriptor[] insertRow)
Save the contents of an constraint supporting index row in a
hash table (which may spill to disk) for later checking,
typically on transaction commit, or upon request.
|
static BackingStoreHashtable |
rememberFKViolation(LanguageConnectionContext lcc,
BackingStoreHashtable deferredRowsHashTable,
UUID fkId,
DataValueDescriptor[] indexRow,
java.lang.String schemaName,
java.lang.String tableName)
Make note of a violated foreign key constraint, i.e. the referenced
key is not present
|
public static BackingStoreHashtable rememberDuplicate(LanguageConnectionContext lcc, BackingStoreHashtable deferredRowsHashTable, UUID constraintId, DataValueDescriptor[] insertRow) throws StandardException
lcc
- the language connection contextdeferredRowsHashTable
- client cached valueconstraintId
- the id of the unique or primary key constraintinsertRow
- the duplicate row to be saved in the hash table
for later checkingStandardException
- standard error policypublic static BackingStoreHashtable rememberCheckViolations(LanguageConnectionContext lcc, UUID basetableId, java.lang.String schemaName, java.lang.String tableName, BackingStoreHashtable deferredCheckViolations, java.util.List<UUID> violatingCheckConstraints, RowLocation offendingRow, DeferredConstraintsMemory.CheckInfo[] result) throws StandardException
CheckInfo#setInvalidatedRowLocations
.basetableId
- the id of the target tableschemaName
- the schema of the target tabletableName
- the target table namedeferredCheckViolations
- client cached valuelcc
- the language connection contextviolatingCheckConstraints
- offending constraint(s)offendingRow
- the duplicate row to be saved in the hash table
for later checkingresult
- OUT parameter: the allocated CheckInfoStandardException
- standard error policypublic static java.util.Enumeration<java.lang.Object> getDeferredCheckConstraintLocations(Activation activation, UUID validatingBaseTableUUID) throws StandardException
StandardException
public static BackingStoreHashtable rememberFKViolation(LanguageConnectionContext lcc, BackingStoreHashtable deferredRowsHashTable, UUID fkId, DataValueDescriptor[] indexRow, java.lang.String schemaName, java.lang.String tableName) throws StandardException
lcc
- the language connection contextdeferredRowsHashTable
- cached client copyfkId
- the UUID of the foreign key constraintindexRow
- the row in the supporting index which contains
the key which is not present in the referenced index.schemaName
- the schema of the tabletableName
- the table being modified that has a FK.StandardException
private static BackingStoreHashtable makeDeferredHashTable(TransactionController tc, int cols) throws StandardException
StandardException
public static void compressOrTruncate(LanguageConnectionContext lcc, UUID tableId, java.lang.String tableName) throws StandardException
StandardException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.