Top Description Fields Constructors Methods
org.apache.derby.impl.sql.execute

public Class BasicSortObserver

extends Object
implements SortObserver
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.store.access.SortObserver
Known Direct Subclasses
org.apache.derby.impl.sql.execute.UniqueIndexSortObserver, org.apache.derby.impl.sql.execute.UniqueWithDuplicateNullsIndexSortObserver, org.apache.derby.impl.sql.execute.AggregateSortObserver
Imports
org.apache.derby.iapi.store.access.SortObserver, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.sql.execute.ExecRow, org.apache.derby.iapi.types.DataValueDescriptor, java.util.Vector, org.apache.derby.shared.common.sanity.SanityManager

This is the most basic sort observer. It handles distinct sorts and non-distinct sorts.

Field Summary

Modifier and TypeField and Description
protected boolean
protected boolean
private ExecRow
private boolean
private Vector<DataValueDescriptor[]>

Constructor Summary

AccessConstructor and Description
public
BasicSortObserver(boolean
If true, then rows that are retained by the sorter will be cloned. This is needed if language is reusing row wrappers.
doClone
,
boolean
If true, toss out duplicates. Otherwise, retain them.
distinct
,
ExecRow
ExecRow to use as source of clone for store.
execRow
,
boolean
Whether or not we can reuse the wrappers
reuseWrappers
)

Simple constructor

Method Summary

Modifier and TypeMethod and Description
public void
public boolean
deferrable()

Implements org.apache.derby.iapi.store.access.SortObserver.deferrable.

Overridden by subclasses that observe sorters with uniqueness checking.

public boolean
deferred()

Implements org.apache.derby.iapi.store.access.SortObserver.deferred.

Overridden by subclasses that observe sorters with uniqueness checking.

public DataValueDescriptor[]
private DataValueDescriptor[]
public DataValueDescriptor[]
insertDuplicateKey(DataValueDescriptor[]
the current row that the sorter is on the verge of retaining. It is a duplicate of existingRow.
insertRow
,
DataValueDescriptor[]
the row that is already in the the sorter which is a duplicate of insertRow
existingRow
)

Implements org.apache.derby.iapi.store.access.SortObserver.insertDuplicateKey.

Called prior to inserting a duplicate sort key.

public DataValueDescriptor[]

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.
insertNonDuplicateKey
(DataValueDescriptor[]
the current row that the sorter is on the verge of retaining
insertRow
)

Implements org.apache.derby.iapi.store.access.SortObserver.insertNonDuplicateKey.

Called prior to inserting a distinct sort key.

public void
rememberDuplicate(DataValueDescriptor[]
data of offending key
row
)

Implements org.apache.derby.iapi.store.access.SortObserver.rememberDuplicate.

Overridden by subclasses that observe sorters with uniqueness checking.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

distinctback to summary
protected boolean distinct
doCloneback to summary
protected boolean doClone
execRowback to summary
private ExecRow execRow
reuseWrappersback to summary
private boolean reuseWrappers
vectorback to summary
private Vector<DataValueDescriptor[]> vector

Constructor Detail

BasicSortObserverback to summary
public BasicSortObserver(boolean doClone, boolean distinct, ExecRow execRow, boolean reuseWrappers)

Simple constructor

Parameters
doClone:boolean

If true, then rows that are retained by the sorter will be cloned. This is needed if language is reusing row wrappers.

distinct:boolean

If true, toss out duplicates. Otherwise, retain them.

execRow:ExecRow

ExecRow to use as source of clone for store.

reuseWrappers:boolean

Whether or not we can reuse the wrappers

Method Detail

addToFreeListback to summary
public void addToFreeList(DataValueDescriptor[] objectArray, int maxFreeListSize)

Implements org.apache.derby.iapi.store.access.SortObserver.addToFreeList.

deferrableback to summary
public boolean deferrable()

Implements org.apache.derby.iapi.store.access.SortObserver.deferrable.

Doc from org.apache.derby.iapi.store.access.SortObserver.deferrable.

Overridden by subclasses that observe sorters with uniqueness checking.

Returns:boolean

true if the index's constraint is deferrable. Any SortObserver implementations that implement uniqueness checking need to keep track of this information.

deferredback to summary
public boolean deferred()

Implements org.apache.derby.iapi.store.access.SortObserver.deferred.

Doc from org.apache.derby.iapi.store.access.SortObserver.deferred.

Overridden by subclasses that observe sorters with uniqueness checking.

Returns:boolean

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.

getArrayCloneback to summary
public DataValueDescriptor[] getArrayClone() throws StandardException

Implements org.apache.derby.iapi.store.access.SortObserver.getArrayClone.

getCloneback to summary
private DataValueDescriptor[] getClone(DataValueDescriptor[] origArray)
insertDuplicateKeyback to summary
public DataValueDescriptor[] insertDuplicateKey(DataValueDescriptor[] insertRow, DataValueDescriptor[] existingRow) throws StandardException

Implements org.apache.derby.iapi.store.access.SortObserver.insertDuplicateKey.

Called prior to inserting a duplicate sort key.

Parameters
insertRow:DataValueDescriptor[]

the current row that the sorter is on the verge of retaining. It is a duplicate of existingRow.

existingRow:DataValueDescriptor[]

the row that is already in the the sorter which is a duplicate of insertRow

Returns:DataValueDescriptor[]

Doc from org.apache.derby.iapi.store.access.SortObserver.insertDuplicateKey.

the row to be inserted by the sorter. If null, then nothing is inserted by the sorter. Distinct sorts will want to return null.

Exceptions
StandardException:
never thrown
insertNonDuplicateKeyback to summary
public DataValueDescriptor[] insertNonDuplicateKey(DataValueDescriptor[] insertRow) throws StandardException

Implements org.apache.derby.iapi.store.access.SortObserver.insertNonDuplicateKey.

Called prior to inserting a distinct sort key.

Parameters
insertRow:DataValueDescriptor[]

the current row that the sorter is on the verge of retaining

Returns:DataValueDescriptor[]

the row to be inserted by the sorter. If null, then nothing is inserted by the sorter. Distinct sorts will want to return null.

Exceptions
StandardException:
never thrown
rememberDuplicateback to summary
public void rememberDuplicate(DataValueDescriptor[] row) throws StandardException

Implements org.apache.derby.iapi.store.access.SortObserver.rememberDuplicate.

Doc from org.apache.derby.iapi.store.access.SortObserver.rememberDuplicate.

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.

Parameters
row:DataValueDescriptor[]

data of offending key

Exceptions
StandardException:
standard error policy