class InsertResultSet extends DMLWriteResultSet implements TargetResultSet
baseRowReadMap, constantAction, deferredSparseRow, heapDCOCI, indexDCOCIs, rowCount, streamStorableHeapColIdsactivation, beginExecutionTime, beginTime, endExecutionTime, endTime, lccCURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST| Constructor and Description |
|---|
InsertResultSet(NoPutResultSet source,
GeneratedMethod generationClauses,
GeneratedMethod checkGM,
int fullTemplate,
Activation activation) |
| Modifier and Type | Method and Description |
|---|---|
private long |
bulkInsertCore(LanguageConnectionContext lcc,
ExecRow fullTemplate,
long oldHeapConglom) |
private void |
bulkValidateForeignKeys(TransactionController tc,
ContextManager cm,
ExecRow fullTemplate)
Bulk Referential Integrity Checker
|
private void |
bulkValidateForeignKeysCore(TransactionController tc,
ContextManager cm,
FKInfo fkInfo,
long fkConglom,
long pkConglom,
java.lang.String fkConstraintName,
ExecRow fullTemplate) |
void |
changedRow(ExecRow execRow,
RowLocation rowLocation)
Pass a changed row and the row location for that row
to the target result set.
|
void |
cleanUp()
Tells the system to clean up on an error.
|
void |
close()
Clean up resources and call close on data members.
|
private void |
emptyIndexes(long newHeapConglom,
InsertConstantAction constants,
TableDescriptor td,
DataDictionary dd,
ExecRow fullTemplate)
Empty the indexes after doing a bulk insert replace
where the table has 0 rows after the replace.
|
private void |
evaluateCheckConstraints()
Run the check constraints against the current row.
|
void |
finish()
Tells the system that there will be no more access
to any database information via this result set;
in particular, no more calls to open().
|
private int[] |
generatedColumnPositionsArray()
If user didn't provide columns list for auto-generated columns, then only include
columns with auto-generated values in the resultset.
|
ResultSet |
getAutoGeneratedKeysResultset()
ResultSet for rows inserted into the table (contains auto-generated keys columns only)
|
private java.lang.String[] |
getColumnNames(int[] baseColumnPositions) |
private ExecRow |
getCompactRow(ExecRow inputRow,
int[] columnIndexes)
Take the input row and return a new compact ExecRow
using the column positions provided in columnIndexes.
|
private boolean |
getExclusiveTableLock()
Get an exclusive table lock on the target table
(and check to see if the table is populated if
this is not a bulk insert replace).
|
ResultDescription |
getResultDescription()
Returns the description of the inserted rows.
|
NumberDataValue |
getSetAutoincrementValue(int columnPosition,
long increment)
getSetAutoincrementValue will get the autoincrement value of the
columnPosition specified for the target table.
|
private BulkTableScanResultSet |
getTableScanResultSet(long conglomId)
Get me a table scan result set, preferably a bulk
table scan, thank you.
|
private boolean |
isSingleRowResultSet() |
private boolean |
isSourceRowResultSet() |
private ExecRow |
makeIndexTemplate(FKInfo fkInfo,
ExecRow fullTemplate,
ContextManager cm)
Make a template row with the correct columns.
|
private void |
normalInsertCore(LanguageConnectionContext lcc,
boolean firstExecute) |
void |
open()
Needs to be called before the result set will do anything.
|
ExecRow |
preprocessSourceRow(ExecRow execRow)
Preprocess the source row.
|
private void |
setEstimatedRowCount(long heapConglom)
Set the estimated row count for this table.
|
private void |
setUpAllSorts(ExecRow sourceRow,
RowLocation rl)
Set up to update all of the indexes on a table when doing a bulk insert
on an empty table.
|
private int[] |
uniqueColumnPositionArray(int[] columnIndexes)
Remove duplicate columns from the array.
|
private void |
updateAllIndexes(long newHeapConglom,
InsertConstantAction constants,
TableDescriptor td,
DataDictionary dd,
ExecRow fullTemplate)
Update all of the indexes on a table when doing a bulk insert
on an empty table.
|
private boolean |
verifyAutoGenColumn(ColumnDescriptor cd)
Check that the received ColumnDescriptor corresponds to a column
for which it is possible to fetch auto-generated keys.
|
private void |
verifyAutoGeneratedColumnsIndexes(int[] columnIndexes)
Verify that the auto-generated columns list (by position) has valid
column positions for the table.
|
private void |
verifyAutoGeneratedColumnsNames(java.lang.String[] columnNames)
Verify that the auto-generated columns list (by name) has valid
column names for the table.
|
protected boolean |
verifyBulkInsert()
Verify that bulkInsert is allowed on this table.
|
decodeLockMode, getIndexNameFromCID, getNextRowCore, makeDeferredSparseRow, modifiedRowCountaddWarning, checkRowPosition, clearCurrentRow, doesCommit, evaluateACheckConstraint, evaluateCheckConstraints, evaluateGenerationClauses, getAbsoluteRow, getActivation, getBeginExecutionTimestamp, getCurrentTimeMillis, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getQueryPlanText, getRelativeRow, getRowNumber, getSubqueryTrackingArray, getTimeSpent, getWarnings, isClosed, returnsRows, setAfterLastRow, setBeforeFirstRow, setupclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddWarning, checkRowPosition, clearCurrentRow, getAbsoluteRow, getActivation, getBeginExecutionTimestamp, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getRelativeRow, getRowNumber, getSubqueryTrackingArray, getTimeSpent, getWarnings, isClosed, modifiedRowCount, returnsRows, setAfterLastRow, setBeforeFirstRowprivate NoPutResultSet sourceResultSet
NoPutResultSet savedSource
InsertConstantAction constants
private GeneratedMethod generationClauses
private GeneratedMethod checkGM
private long heapConglom
private ResultSet autoGeneratedKeysResultSet
private TemporaryRowHolderImpl autoGeneratedKeysRowsHolder
private int[] autoGeneratedKeysColumnIndexes
private ResultDescription resultDescription
private RowChanger rowChanger
private TransactionController tc
private ExecRow row
boolean userSpecifiedBulkInsert
boolean bulkInsertPerformed
protected boolean bulkInsert
private boolean bulkInsertReplace
private boolean firstRow
private boolean[] needToDropSort
private java.util.Hashtable indexConversionTable
private FormatableBitSet indexedCols
private ConglomerateController bulkHeapCC
protected DataDictionary dd
protected TableDescriptor td
private ExecIndexRow[] indexRows
private final int fullTemplateId
private long[] sortIds
private RowLocationRetRowSource[] rowSources
private ScanController bulkHeapSC
private ColumnOrdering[][] ordering
private int[][] collation
private SortController[] sorters
private TemporaryRowHolderImpl rowHolder
private RowLocation rl
private boolean hasBeforeStatementTrigger
private boolean hasBeforeRowTrigger
private BulkTableScanResultSet tableScan
private int numOpens
private boolean firstExecute
private FKInfo[] fkInfoArray
private TriggerInfo triggerInfo
private RISetChecker fkChecker
private TriggerEventActivator triggerActivator
private NumberDataValue[] aiCache
protected boolean autoincrementGenerated
private long identityVal
private boolean setIdentity
InsertResultSet(NoPutResultSet source, GeneratedMethod generationClauses, GeneratedMethod checkGM, int fullTemplate, Activation activation) throws StandardException
StandardException - Thrown on errorpublic ResultDescription getResultDescription()
getResultDescription in interface ResultSetgetResultDescription in class NoRowsResultSetImplpublic void changedRow(ExecRow execRow, RowLocation rowLocation) throws StandardException
TargetResultSetchangedRow in interface TargetResultSetexecRow - The changed row.rowLocation - The row location of the row.StandardException - thrown if cursor finish ed.TargetResultSet.changedRow(org.apache.derby.iapi.sql.execute.ExecRow, org.apache.derby.iapi.types.RowLocation)public ExecRow preprocessSourceRow(ExecRow execRow) throws StandardException
preprocessSourceRow in interface TargetResultSetexecRow - The source row.StandardException - thrown on errorprivate void evaluateCheckConstraints()
throws StandardException
StandardException - thrown on errorpublic void open()
throws StandardException
ResultSetopen in interface ResultSetStandardException - Standard Derby error policypublic void close()
throws StandardException
close in interface ResultSetclose in class NoRowsResultSetImplStandardException - thrown on errorprivate void verifyAutoGeneratedColumnsIndexes(int[] columnIndexes)
throws StandardException
StandardExceptionprivate int[] generatedColumnPositionsArray()
throws StandardException
StandardExceptionprivate int[] uniqueColumnPositionArray(int[] columnIndexes)
throws StandardException
StandardExceptionprivate void verifyAutoGeneratedColumnsNames(java.lang.String[] columnNames)
throws StandardException
StandardException - Thrown on error if invalid column
name in the list.private boolean verifyAutoGenColumn(ColumnDescriptor cd)
public ResultSet getAutoGeneratedKeysResultset()
ResultSetgetAutoGeneratedKeysResultset in interface ResultSetgetAutoGeneratedKeysResultset in class NoRowsResultSetImplResultSet.getAutoGeneratedKeysResultset()public NumberDataValue getSetAutoincrementValue(int columnPosition, long increment) throws StandardException
columnPosition - position of the column in the table (1-based)increment - amount of increment.StandardException - if anything goes wrong.private boolean isSourceRowResultSet()
private boolean isSingleRowResultSet()
private void normalInsertCore(LanguageConnectionContext lcc, boolean firstExecute) throws StandardException
StandardExceptionprivate ExecRow getCompactRow(ExecRow inputRow, int[] columnIndexes) throws StandardException
StandardExceptionprivate long bulkInsertCore(LanguageConnectionContext lcc, ExecRow fullTemplate, long oldHeapConglom) throws StandardException
StandardExceptionprivate void bulkValidateForeignKeys(TransactionController tc, ContextManager cm, ExecRow fullTemplate) throws StandardException
StandardExceptionprivate void bulkValidateForeignKeysCore(TransactionController tc, ContextManager cm, FKInfo fkInfo, long fkConglom, long pkConglom, java.lang.String fkConstraintName, ExecRow fullTemplate) throws StandardException
StandardExceptionprivate ExecRow makeIndexTemplate(FKInfo fkInfo, ExecRow fullTemplate, ContextManager cm) throws StandardException
StandardExceptionprivate void setUpAllSorts(ExecRow sourceRow, RowLocation rl) throws StandardException
StandardException - thrown on errorprivate void updateAllIndexes(long newHeapConglom,
InsertConstantAction constants,
TableDescriptor td,
DataDictionary dd,
ExecRow fullTemplate)
throws StandardException
StandardException - thrown on errorpublic void cleanUp()
throws StandardException
ResultSetcleanUp in interface ResultSetStandardException - Thrown on errorResultSet.cleanUp()protected boolean verifyBulkInsert()
throws StandardException
StandardException - Thrown on errorprivate boolean getExclusiveTableLock()
throws StandardException
StandardException - Thrown on errorprivate void setEstimatedRowCount(long heapConglom)
throws StandardException
heapConglom - Conglomerate number for the heapStandardException - Thrown on failureprivate void emptyIndexes(long newHeapConglom,
InsertConstantAction constants,
TableDescriptor td,
DataDictionary dd,
ExecRow fullTemplate)
throws StandardException
StandardException - Thrown on failureprivate BulkTableScanResultSet getTableScanResultSet(long conglomId) throws StandardException
StandardExceptionprivate java.lang.String[] getColumnNames(int[] baseColumnPositions)
public void finish()
throws StandardException
ResultSetfinish in interface ResultSetfinish in class NoRowsResultSetImplStandardException - on errorApache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.