Class UniqueIndexSortObserver
java.lang.Object
org.apache.derby.impl.sql.execute.BasicSortObserver
org.apache.derby.impl.sql.execute.UniqueIndexSortObserver
- All Implemented Interfaces:
SortObserver
Unique index aggregator. Enforces uniqueness when
creating a unique index or constraint.
-
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
ConstructorsConstructorDescriptionUniqueIndexSortObserver(LanguageConnectionContext lcc, UUID constraintId, boolean doClone, boolean deferrable, boolean deferred, String indexOrConstraintName, ExecRow execRow, boolean reuseWrappers, String tableName) -
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) Called prior to inserting a duplicate sort key.voidOverridden by subclasses that observe sorters with uniqueness checking.Methods inherited from class BasicSortObserver
addToFreeList, getArrayClone, insertNonDuplicateKey
-
Field Details
-
deferrable
private final boolean deferrable -
deferred
private final boolean deferred -
indexOrConstraintName
-
tableName
-
lcc
-
constraintId
-
deferredDuplicates
-
-
Constructor Details
-
UniqueIndexSortObserver
public UniqueIndexSortObserver(LanguageConnectionContext lcc, UUID constraintId, boolean doClone, boolean deferrable, boolean deferred, String indexOrConstraintName, ExecRow execRow, boolean reuseWrappers, String tableName)
-
-
Method Details
-
insertDuplicateKey
public DataValueDescriptor[] insertDuplicateKey(DataValueDescriptor[] in, DataValueDescriptor[] dup) throws StandardException Description copied from class:BasicSortObserverCalled prior to inserting a duplicate sort key.- Specified by:
insertDuplicateKeyin interfaceSortObserver- Overrides:
insertDuplicateKeyin classBasicSortObserver- Parameters:
in- the current row that the sorter is on the verge of retaining. It is a duplicate of existingRow.dup- the row that is already in the the sorter which is a duplicate of insertRow- Returns:
- the row to be inserted by the sorter. If null, then nothing is inserted by the sorter. Distinct sorts will want to return null.
- Throws:
StandardException- never thrown
-
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
-