Class RowChangerImpl
java.lang.Object
org.apache.derby.impl.sql.execute.RowChangerImpl
- All Implemented Interfaces:
RowChanger
Perform row at a time DML operations of tables and maintain indexes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Activation
private ConglomerateController
private RowLocation
(package private) FormatableBitSet
private int[]
(package private) FormatableBitSet
(package private) int[]
(package private) boolean[]
(package private) long
(package private) DynamicCompiledOpenConglomInfo
(package private) StaticCompiledOpenConglomInfo
(package private) long[]
(package private) DynamicCompiledOpenConglomInfo[]
(package private) String[]
(package private) StaticCompiledOpenConglomInfo[]
(package private) IndexRowGenerator[]
private IndexSetChanger
(package private) boolean
private int[]
(package private) TemporaryRowHolderImpl
private DataValueDescriptor[]
(package private) TransactionController
-
Constructor Summary
ConstructorsConstructorDescriptionRowChangerImpl
(long heapConglom, StaticCompiledOpenConglomInfo heapSCOCI, DynamicCompiledOpenConglomInfo heapDCOCI, IndexRowGenerator[] irgs, long[] indexCIDS, StaticCompiledOpenConglomInfo[] indexSCOCIs, DynamicCompiledOpenConglomInfo[] indexDCOCIs, int numberOfColumns, int[] changedColumnIdsInput, TransactionController tc, FormatableBitSet baseRowReadList, int[] baseRowReadMap, Activation activation) Create a new RowChanger for performing update and delete operations based on partial before and after rows. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close this RowChanger.void
deleteRow
(ExecRow baseRow, RowLocation baseRowLocation) Delete a row from the table and perform associated index maintenance.int
findSelectedCol
(int selectedCol) Return what column no in the input ExecRow (cf nextBaseRow argument to #updateRow) would correspond to selected column, if any.void
finish()
Finish processing the changes.Return the ConglomerateController from this RowChanger.Insert a row into the table and perform associated index maintenance.void
open
(int lockMode) Open this RowChanger.void
open
(int lockMode, boolean wait) Open this RowChanger.void
openForUpdate
(boolean[] fixOnUpdate, int lockMode, boolean wait) Open this RowChanger to avoid fixing indexes that do not change during update operations.void
setIndexNames
(String[] indexNames) Sets the index names of the tables indices.void
setRowHolder
(TemporaryRowHolder rowHolder) Set the row holder for this changer to use.private int[]
sortArray
(int[] input) toString()
void
updateRow
(ExecRow oldBaseRow, ExecRow newBaseRow, RowLocation baseRowLocation) Update a row in the table and perform associated index maintenance.
-
Field Details
-
isOpen
boolean isOpen -
fixOnUpdate
boolean[] fixOnUpdate -
heapConglom
long heapConglom -
heapDCOCI
DynamicCompiledOpenConglomInfo heapDCOCI -
heapSCOCI
StaticCompiledOpenConglomInfo heapSCOCI -
indexCIDS
long[] indexCIDS -
indexDCOCIs
DynamicCompiledOpenConglomInfo[] indexDCOCIs -
indexSCOCIs
StaticCompiledOpenConglomInfo[] indexSCOCIs -
irgs
IndexRowGenerator[] irgs -
activation
-
tc
-
changedColumnBitSet
FormatableBitSet changedColumnBitSet -
baseRowReadList
FormatableBitSet baseRowReadList -
baseRowReadMap
private int[] baseRowReadMap -
changedColumnIds
int[] changedColumnIds -
rowHolder
TemporaryRowHolderImpl rowHolder -
indexNames
String[] indexNames -
baseCC
-
baseRowLocation
-
isc
-
sparseRowArray
-
partialChangedColumnIds
private int[] partialChangedColumnIds
-
-
Constructor Details
-
RowChangerImpl
public RowChangerImpl(long heapConglom, StaticCompiledOpenConglomInfo heapSCOCI, DynamicCompiledOpenConglomInfo heapDCOCI, IndexRowGenerator[] irgs, long[] indexCIDS, StaticCompiledOpenConglomInfo[] indexSCOCIs, DynamicCompiledOpenConglomInfo[] indexDCOCIs, int numberOfColumns, int[] changedColumnIdsInput, TransactionController tc, FormatableBitSet baseRowReadList, int[] baseRowReadMap, Activation activation) throws StandardException Create a new RowChanger for performing update and delete operations based on partial before and after rows.- Parameters:
heapConglom
- Conglomerate # for the heapheapSCOCI
- SCOCI for heap.heapDCOCI
- DCOCI for heapirgs
- the IndexRowGenerators for the table's indexes. We use positions in this array as local id's for indexes. To support updates, only indexes that change need be included.indexCIDS
- the conglomerateids for the table's idexes. indexCIDS[ix] corresponds to the same index as irgs[ix].indexSCOCIs
- the SCOCIs for the table's idexes. indexSCOCIs[ix] corresponds to the same index as irgs[ix].indexDCOCIs
- the DCOCIs for the table's idexes. indexDCOCIs[ix] corresponds to the same index as irgs[ix].numberOfColumns
- Number of columns in partial write row.changedColumnIdsInput
- array of 1 based ints indicating the columns to be updated. Only used for updatestc
- the transaction controllerbaseRowReadList
- bit set of columns read from base row. 1 based.baseRowReadMap
- BaseRowReadMap[heapColId]->ReadRowColumnId. (0 based)- Throws:
StandardException
- Thrown on error
-
-
Method Details
-
setRowHolder
Set the row holder for this changer to use. If the row holder is set, it wont bother saving copies of rows needed for deferred processing. Also, it will never close the passed in rowHolder.- Specified by:
setRowHolder
in interfaceRowChanger
- Parameters:
rowHolder
- the TemporaryRowHolder
-
setIndexNames
Description copied from interface:RowChanger
Sets the index names of the tables indices. Used for error reporting.- Specified by:
setIndexNames
in interfaceRowChanger
- Parameters:
indexNames
- Names of all the indices on this table.- See Also:
-
open
Open this RowChanger.Note to avoid the cost of fixing indexes that do not change during update operations use openForUpdate().
- Specified by:
open
in interfaceRowChanger
- Parameters:
lockMode
- The lock mode to use (row or table, see TransactionController)- Throws:
StandardException
- thrown on failure to convert
-
open
Description copied from interface:RowChanger
Open this RowChanger.Note to avoid the cost of fixing indexes that do not change during update operations use openForUpdate().
- Specified by:
open
in interfaceRowChanger
- Parameters:
lockMode
- The lock mode to use (row or table, see TransactionController)wait
- If true, then the caller wants to wait for locks. False will be when we using a nested user xaction - we want to timeout right away if the parent holds the lock.- Throws:
StandardException
- thrown on failure to convert
-
openForUpdate
public void openForUpdate(boolean[] fixOnUpdate, int lockMode, boolean wait) throws StandardException Open this RowChanger to avoid fixing indexes that do not change during update operations.- Specified by:
openForUpdate
in interfaceRowChanger
- Parameters:
fixOnUpdate
- fixOnUpdat[ix] == true ==> fix index 'ix' on an update operation.lockMode
- The lock mode to use (row or table, see TransactionController)wait
- If true, then the caller wants to wait for locks. False will be when we using a nested user xaction - we want to timeout right away if the parent holds the lock. (bug 4821)- Throws:
StandardException
- thrown on failure to convert
-
insertRow
Insert a row into the table and perform associated index maintenance.- Specified by:
insertRow
in interfaceRowChanger
- Parameters:
baseRow
- the row.getRL
- return a row location of the inserted row- Returns:
- row location if requested, else
null
. - Throws:
StandardException
- Thrown on error
-
deleteRow
Delete a row from the table and perform associated index maintenance.- Specified by:
deleteRow
in interfaceRowChanger
- Parameters:
baseRow
- the row.baseRowLocation
- the row's base conglomerate location- Throws:
StandardException
- Thrown on error
-
updateRow
public void updateRow(ExecRow oldBaseRow, ExecRow newBaseRow, RowLocation baseRowLocation) throws StandardException Update a row in the table and perform associated index maintenance.- Specified by:
updateRow
in interfaceRowChanger
- Parameters:
oldBaseRow
- the old image of the row.newBaseRow
- the new image of the row.baseRowLocation
- the row's base conglomerate location- Throws:
StandardException
- Thrown on error
-
finish
Finish processing the changes. This means applying the deferred inserts for updates to unique indexes.- Specified by:
finish
in interfaceRowChanger
- Throws:
StandardException
- Thrown on error
-
close
Close this RowChanger.- Specified by:
close
in interfaceRowChanger
- Throws:
StandardException
- Thrown on error
-
getHeapConglomerateController
Description copied from interface:RowChanger
Return the ConglomerateController from this RowChanger. This is useful when copying properties from heap to temp conglomerate on insert/update/delete.- Specified by:
getHeapConglomerateController
in interfaceRowChanger
- Returns:
- The ConglomerateController from this RowChanger.
- See Also:
-
sortArray
private int[] sortArray(int[] input) -
findSelectedCol
public int findSelectedCol(int selectedCol) Description copied from interface:RowChanger
Return what column no in the input ExecRow (cf nextBaseRow argument to #updateRow) would correspond to selected column, if any.- Specified by:
findSelectedCol
in interfaceRowChanger
- Parameters:
selectedCol
- the column number in the base table of a selected column or -1 (if selected column is not a base table column, e.g. i+4).- Returns:
- column no, or -1 if not found or not a base column
-
toString
-