Class UniqueWithDuplicateNullsIndexSortObserver
java.lang.Object
org.apache.derby.impl.sql.execute.BasicSortObserver
org.apache.derby.impl.sql.execute.UniqueWithDuplicateNullsIndexSortObserver
- All Implemented Interfaces:
SortObserver
UniqueWithDuplicateNullsIndexSortObserver is implementation of BasicSortObserver for
eliminating non null duplicates from the backing index of unique constraint.
This class is implemented to check for special case of distinct sorting where
duplicate keys are allowed only if there is a null in the key part.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final UUIDprivate final booleanprivate final booleanprivate BackingStoreHashtableprivate final Stringprivate final LanguageConnectionContextprivate final StringFields inherited from class BasicSortObserver
distinct, doClone -
Constructor Summary
ConstructorsConstructorDescriptionUniqueWithDuplicateNullsIndexSortObserver(LanguageConnectionContext lcc, UUID constraintId, boolean doClone, boolean deferrable, boolean deferred, String indexOrConstraintName, ExecRow execRow, boolean reuseWrappers, String tableName) Constructs an object of UniqueWithDuplicateNullsIndexSortObserver -
Method Summary
Modifier and TypeMethodDescriptionbooleanOverridden by subclasses that observe sorters with uniqueness checking.booleandeferred()Overridden by subclasses that observe sorters with uniqueness checking.insertDuplicateKey(DataValueDescriptor[] in, DataValueDescriptor[] dup) Methods to check if the duplicate key can be inserted or not.voidOverridden by subclasses that observe sorters with uniqueness checking.Methods inherited from class BasicSortObserver
addToFreeList, getArrayClone, insertNonDuplicateKey
-
Field Details
-
indexOrConstraintName
-
tableName
-
deferrable
private final boolean deferrable -
deferred
private final boolean deferred -
lcc
-
constraintId
-
deferredDuplicates
-
-
Constructor Details
-
UniqueWithDuplicateNullsIndexSortObserver
public UniqueWithDuplicateNullsIndexSortObserver(LanguageConnectionContext lcc, UUID constraintId, boolean doClone, boolean deferrable, boolean deferred, String indexOrConstraintName, ExecRow execRow, boolean reuseWrappers, String tableName) Constructs an object of UniqueWithDuplicateNullsIndexSortObserver- Parameters:
lcc- Language Connection contextconstraintId- Id of the constraint (only used for deferrable constraints)doClone- If true, then rows that are retained by the sorter will be cloned. This is needed if language is reusing row wrappers.deferrable- deferrable constraintdeferred- constraint mode is deferredindexOrConstraintName- name of index of constraintexecRow- ExecRow to use as source of clone for store.reuseWrappers- Whether or not we can reuse the wrapperstableName- name of the table
-
-
Method Details
-
insertDuplicateKey
public DataValueDescriptor[] insertDuplicateKey(DataValueDescriptor[] in, DataValueDescriptor[] dup) throws StandardException Methods to check if the duplicate key can be inserted or not. It throws exception if the duplicates has no null part in the key.- Specified by:
insertDuplicateKeyin interfaceSortObserver- Overrides:
insertDuplicateKeyin classBasicSortObserver- Parameters:
in- new keydup- the new key is duplicate of this key- Returns:
- DVD [] if there is at least one null in the key else throws StandardException
- Throws:
StandardException- is the duplicate key has all non null parts
-
deferred
public boolean deferred()Description copied from interface:SortObserverOverridden by subclasses that observe sorters with uniqueness checking.- Specified by:
deferredin interfaceSortObserver- Overrides:
deferredin classBasicSortObserver- Returns:
- true if constraint mode of the index's constraint is effectively deferred. Any SortObserver implementations that implement uniqueness checking need to keep track of this information.
-
deferrable
public boolean deferrable()Description copied from interface:SortObserverOverridden by subclasses that observe sorters with uniqueness checking.- Specified by:
deferrablein interfaceSortObserver- Overrides:
deferrablein classBasicSortObserver- Returns:
- true if the index's constraint is deferrable. Any SortObserver implementations that implement uniqueness checking need to keep track of this information.
-
rememberDuplicate
Description copied from interface:SortObserverOverridden by subclasses that observe sorters with uniqueness checking. Will be called by sorters iff deferrable() and deferred() and uniqueness violation, so implementations that sometimes return true to these must implement this method to save duplicate information till commit time.- Specified by:
rememberDuplicatein interfaceSortObserver- Overrides:
rememberDuplicatein classBasicSortObserver- Parameters:
row- data of offending key- Throws:
StandardException- standard error policy
-