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

pack-priv Class TemporaryRowHolderImpl

extends Object
implements TemporaryRowHolder
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.sql.execute.TemporaryRowHolder
Imports
org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.sql.execute.CursorResultSet, .ExecRow, .TemporaryRowHolder, org.apache.derby.iapi.sql.Activation, .ResultDescription, org.apache.derby.iapi.store.access.ConglomerateController, .ScanController, .TransactionController, org.apache.derby.iapi.types.RowLocation, .DataValueDescriptor, .SQLRef, .SQLLongint, java.util.Properties

This is a class that is used to temporarily (non-persistently) hold rows that are used in language execution. It will store them in an array, or a temporary conglomerate, depending on the number of rows.

It is used for deferred DML processing.

Field Summary

Modifier and TypeField and Description
pack-priv Activation
activation

Activation object with local state information.

private ConglomerateController
private long
private boolean
public static final int
private RowLocation
private boolean
private boolean
protected int
private int
private SQLLongint
private ConglomerateController
private long
private boolean
private DataValueDescriptor[]
private Properties
private ResultDescription
protected ExecRow[]
private ScanController
protected int
protected static final int
protected static final int
protected static final int
private ConglomerateController
private long
private boolean
private DataValueDescriptor[]

Constructor Summary

AccessConstructor and Description
public
TemporaryRowHolderImpl(Activation
the activation
activation
,
Properties
the properties of the original table. Used to help the store use optimal page size, etc.
properties
,
ResultDescription
the result description. Relevant for the getResultDescription call on the result set returned by getResultSet. May be null
resultDescription
)

Uses the default overflow to a conglomerate threshold (5).

public
TemporaryRowHolderImpl(Activation
the activation
activation
,
Properties
the properties of the original table. Used to help the store use optimal page size, etc.
properties
,
ResultDescription
the result description. Relevant for the getResultDescription call on the result set returned by getResultSet. May be null
resultDescription
,
boolean
- true , if it has to be temporary row holder unique stream
isUniqueStream
)

Uses the default overflow to a conglomerate threshold (5).

public
TemporaryRowHolderImpl(Activation
the activation
activation
,
Properties
the properties of the original table. Used to help the store use optimal page size, etc.
properties
,
ResultDescription
the result description. Relevant for the getResultDescription call on the result set returned by getResultSet. May be null
resultDescription
,
int
on an attempt to insert this number of rows, the rows will be put into a temporary conglomerate.
overflowToConglomThreshold
,
boolean isUniqueStream, boolean isVirtualMemHeap)

Create a temporary row holder with the defined overflow to conglom

Method Summary

Modifier and TypeMethod and Description
private ExecRow
cloneRow(ExecRow inputRow)

public void
public long
public CursorResultSet

Returns:

a result set to use
getResultSet
()

Implements org.apache.derby.iapi.sql.execute.TemporaryRowHolder.getResultSet.

Get a result set for scanning what has been inserted so far.

public long

Returns:

Conglomerate ID of temporary conglomerate
getTemporaryConglomId
()

Implements org.apache.derby.iapi.sql.execute.TemporaryRowHolder.getTemporaryConglomId.

Accessor to get the id of the temporary conglomerate.

public void
insert(ExecRow
the row to insert
inputRow
)

Implements org.apache.derby.iapi.sql.execute.TemporaryRowHolder.insert.

Insert a row

private void
insertToPositionIndex(int
- the number of the row we are inserting into heap
position
,
RowLocation
the row to Location in the temporary heap
rl
)

Maintain an index that will allow us to read from the temporary heap in the order we inserted.

private boolean
isRowAlreadyExist(ExecRow
the row we are inserting to temporary row holder
inputRow
)

Maintain an unique index based on the input row's row location in the base table, this index make sures that we don't insert duplicate rows into the temporary heap.

private Properties
makeIndexProperties(DataValueDescriptor[] indexRowArray, long conglomId)

private DataValueDescriptor[]
makeTemplateRow(DataValueDescriptor[]
The original row
originalRow
)

Make a template row for creating the spillover conglomerate.

public void
public void
truncate()

Purge the row holder of all its rows.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

activationback to summary
pack-priv Activation activation

Activation object with local state information.

ccback to summary
private ConglomerateController cc
CIDback to summary
private long CID
conglomCreatedback to summary
private boolean conglomCreated
DEFAULT_OVERFLOWTHRESHOLDback to summary
public static final int DEFAULT_OVERFLOWTHRESHOLD
destRowLocationback to summary
private RowLocation destRowLocation
isUniqueStreamback to summary
private boolean isUniqueStream
isVirtualMemHeapback to summary
private boolean isVirtualMemHeap
lastArraySlotback to summary
protected int lastArraySlot
numRowsInback to summary
private int numRowsIn
position_sqllongback to summary
private SQLLongint position_sqllong
positionIndex_ccback to summary
private ConglomerateController positionIndex_cc
positionIndexConglomIdback to summary
private long positionIndexConglomId
positionIndexCreatedback to summary
private boolean positionIndexCreated
positionIndexRowback to summary
private DataValueDescriptor[] positionIndexRow
propertiesback to summary
private Properties properties
resultDescriptionback to summary
private ResultDescription resultDescription
rowArrayback to summary
protected ExecRow[] rowArray
scanback to summary
private ScanController scan
stateback to summary
protected int state
STATE_DRAINback to summary
protected static final int STATE_DRAIN
STATE_INSERTback to summary
protected static final int STATE_INSERT
STATE_UNINITback to summary
protected static final int STATE_UNINIT
uniqueIndex_ccback to summary
private ConglomerateController uniqueIndex_cc
uniqueIndexConglomIdback to summary
private long uniqueIndexConglomId
uniqueIndexCreatedback to summary
private boolean uniqueIndexCreated
uniqueIndexRowback to summary
private DataValueDescriptor[] uniqueIndexRow

Constructor Detail

TemporaryRowHolderImplback to summary
public TemporaryRowHolderImpl(Activation activation, Properties properties, ResultDescription resultDescription)

Uses the default overflow to a conglomerate threshold (5).

Parameters
activation:Activation

the activation

properties:Properties

the properties of the original table. Used to help the store use optimal page size, etc.

resultDescription:ResultDescription

the result description. Relevant for the getResultDescription call on the result set returned by getResultSet. May be null

TemporaryRowHolderImplback to summary
public TemporaryRowHolderImpl(Activation activation, Properties properties, ResultDescription resultDescription, boolean isUniqueStream)

Uses the default overflow to a conglomerate threshold (5).

Parameters
activation:Activation

the activation

properties:Properties

the properties of the original table. Used to help the store use optimal page size, etc.

resultDescription:ResultDescription

the result description. Relevant for the getResultDescription call on the result set returned by getResultSet. May be null

isUniqueStream:boolean

- true , if it has to be temporary row holder unique stream

TemporaryRowHolderImplback to summary
public TemporaryRowHolderImpl(Activation activation, Properties properties, ResultDescription resultDescription, int overflowToConglomThreshold, boolean isUniqueStream, boolean isVirtualMemHeap)

Create a temporary row holder with the defined overflow to conglom

Parameters
activation:Activation

the activation

properties:Properties

the properties of the original table. Used to help the store use optimal page size, etc.

resultDescription:ResultDescription

the result description. Relevant for the getResultDescription call on the result set returned by getResultSet. May be null

overflowToConglomThreshold:int

on an attempt to insert this number of rows, the rows will be put into a temporary conglomerate.

Method Detail

cloneRowback to summary
private ExecRow cloneRow(ExecRow inputRow)
closeback to summary
public void close() throws StandardException

Implements org.apache.derby.iapi.sql.execute.TemporaryRowHolder.close.

Clean up

Exceptions
StandardException:
on error
getPositionIndexConglomIdback to summary
public long getPositionIndexConglomId()

Implements org.apache.derby.iapi.sql.execute.TemporaryRowHolder.getPositionIndexConglomId.

getResultSetback to summary
public CursorResultSet getResultSet()

Implements org.apache.derby.iapi.sql.execute.TemporaryRowHolder.getResultSet.

Get a result set for scanning what has been inserted so far.

Returns:CursorResultSet

a result set to use

getTemporaryConglomIdback to summary
public long getTemporaryConglomId()

Implements org.apache.derby.iapi.sql.execute.TemporaryRowHolder.getTemporaryConglomId.

Accessor to get the id of the temporary conglomerate. Temporary conglomerates have negative ids. An id equal to zero means that no temporary conglomerate has been created.

Returns:long

Conglomerate ID of temporary conglomerate

insertback to summary
public void insert(ExecRow inputRow) throws StandardException

Implements org.apache.derby.iapi.sql.execute.TemporaryRowHolder.insert.

Insert a row

Parameters
inputRow:ExecRow

the row to insert

Exceptions
StandardException:
on error
insertToPositionIndexback to summary
private void insertToPositionIndex(int position, RowLocation rl) throws StandardException

Maintain an index that will allow us to read from the temporary heap in the order we inserted.

Parameters
position:int

- the number of the row we are inserting into heap

rl:RowLocation

the row to Location in the temporary heap

Exceptions
StandardException:
on error
isRowAlreadyExistback to summary
private boolean isRowAlreadyExist(ExecRow inputRow) throws StandardException

Maintain an unique index based on the input row's row location in the base table, this index make sures that we don't insert duplicate rows into the temporary heap.

Parameters
inputRow:ExecRow

the row we are inserting to temporary row holder

Exceptions
StandardException:
on error
makeIndexPropertiesback to summary
private Properties makeIndexProperties(DataValueDescriptor[] indexRowArray, long conglomId) throws StandardException
makeTemplateRowback to summary
private DataValueDescriptor[] makeTemplateRow(DataValueDescriptor[] originalRow) throws StandardException

Make a template row for creating the spillover conglomerate. We only do this for MERGE statments. MERGE processing can temporarily stuff literal nulls into the DataValueDescriptor slot for an autoincrement column. The null DataValueDescriptor can not be used to create the layout of the spillover conglomerate. See DERBY-7144.

Parameters
originalRow:DataValueDescriptor[]

The original row

setRowHolderTypeToUniqueStreamback to summary
public void setRowHolderTypeToUniqueStream()

Implements org.apache.derby.iapi.sql.execute.TemporaryRowHolder.setRowHolderTypeToUniqueStream.

truncateback to summary
public void truncate() throws StandardException

Purge the row holder of all its rows. Resets the row holder so that it can accept new inserts. A cheap way to recycle a row holder.

Exceptions
StandardException:
on error