Class UniqueIndexSortObserver
- java.lang.Object
-
- org.apache.derby.impl.sql.execute.BasicSortObserver
-
- org.apache.derby.impl.sql.execute.UniqueIndexSortObserver
-
- All Implemented Interfaces:
SortObserver
class UniqueIndexSortObserver extends BasicSortObserver
Unique index aggregator. Enforces uniqueness when creating a unique index or constraint.
-
-
Field Summary
Fields Modifier and Type Field Description private UUID
constraintId
private boolean
deferrable
private boolean
deferred
private BackingStoreHashtable
deferredDuplicates
private java.lang.String
indexOrConstraintName
private LanguageConnectionContext
lcc
private java.lang.String
tableName
-
Fields inherited from class org.apache.derby.impl.sql.execute.BasicSortObserver
distinct, doClone
-
-
Constructor Summary
Constructors Constructor Description UniqueIndexSortObserver(LanguageConnectionContext lcc, UUID constraintId, boolean doClone, boolean deferrable, boolean deferred, java.lang.String indexOrConstraintName, ExecRow execRow, boolean reuseWrappers, java.lang.String tableName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
deferrable()
Overridden by subclasses that observe sorters with uniqueness checking.boolean
deferred()
Overridden by subclasses that observe sorters with uniqueness checking.DataValueDescriptor[]
insertDuplicateKey(DataValueDescriptor[] in, DataValueDescriptor[] dup)
Called prior to inserting a duplicate sort key.void
rememberDuplicate(DataValueDescriptor[] row)
Overridden by subclasses that observe sorters with uniqueness checking.-
Methods inherited from class org.apache.derby.impl.sql.execute.BasicSortObserver
addToFreeList, getArrayClone, insertNonDuplicateKey
-
-
-
-
Field Detail
-
deferrable
private final boolean deferrable
-
deferred
private final boolean deferred
-
indexOrConstraintName
private final java.lang.String indexOrConstraintName
-
tableName
private final java.lang.String tableName
-
lcc
private final LanguageConnectionContext lcc
-
constraintId
private final UUID constraintId
-
deferredDuplicates
private BackingStoreHashtable deferredDuplicates
-
-
Constructor Detail
-
UniqueIndexSortObserver
public UniqueIndexSortObserver(LanguageConnectionContext lcc, UUID constraintId, boolean doClone, boolean deferrable, boolean deferred, java.lang.String indexOrConstraintName, ExecRow execRow, boolean reuseWrappers, java.lang.String tableName)
-
-
Method Detail
-
insertDuplicateKey
public DataValueDescriptor[] insertDuplicateKey(DataValueDescriptor[] in, DataValueDescriptor[] dup) throws StandardException
Description copied from class:BasicSortObserver
Called prior to inserting a duplicate sort key.- Specified by:
insertDuplicateKey
in interfaceSortObserver
- Overrides:
insertDuplicateKey
in 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:SortObserver
Overridden by subclasses that observe sorters with uniqueness checking.- Specified by:
deferred
in interfaceSortObserver
- Overrides:
deferred
in 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:SortObserver
Overridden by subclasses that observe sorters with uniqueness checking.- Specified by:
deferrable
in interfaceSortObserver
- Overrides:
deferrable
in 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
public void rememberDuplicate(DataValueDescriptor[] row) throws StandardException
Description copied from interface:SortObserver
Overridden 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:
rememberDuplicate
in interfaceSortObserver
- Overrides:
rememberDuplicate
in classBasicSortObserver
- Parameters:
row
- data of offending key- Throws:
StandardException
- standard error policy
-
-