class InsertResultSet extends DMLWriteGeneratedColumnsResultSet implements TargetResultSet
aiCache, autoGeneratedKeysColumnIndexes, autoGeneratedKeysResultSet, autoGeneratedKeysRowsHolder, autoincrementGenerated, identitySequenceUUIDString, identityVal, setIdentity, sourceResultSet
baseRowReadMap, cachedDestinations, constantAction, heapDCOCI, indexDCOCIs, resultDescription, rowCount, streamStorableHeapColIds
activation, beginExecutionTime, beginTime, endExecutionTime, endTime, lcc
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST
Constructor and Description |
---|
InsertResultSet(NoPutResultSet source,
GeneratedMethod generationClauses,
GeneratedMethod checkGM,
int fullTemplate,
java.lang.String schemaName,
java.lang.String tableName,
Activation activation) |
Modifier and Type | Method and Description |
---|---|
private void |
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 boolean |
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.
|
private java.lang.String[] |
getColumnNames(int[] baseColumnPositions) |
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).
|
protected ExecRow |
getNextRowCore(NoPutResultSet source)
Get next row from the source result set.
|
private void |
getOldStyleBulkInsertValue(int index,
long increment)
Identity generation logic for bulk-insert used in pre-10.11 databases.
|
private NumberDataValue |
getOldStyleIdentityValue(int index)
Identity generation logic used in pre-10.11 databases.
|
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.
|
protected void |
initializeAIcache(RowLocation[] rla) |
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 |
offendingRowLocation(RowLocation rl,
long constainerId) |
void |
open()
Needs to be called before the result set will do anything.
|
ExecRow |
preprocessSourceRow(ExecRow execRow)
Preprocess the source row.
|
private ExecRow |
processMergeRow(NoPutResultSet sourceRS,
ExecRow row)
Special handling if this is an INSERT action of a MERGE statement.
|
void |
rememberConstraint(UUID cid) |
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 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.
|
protected boolean |
verifyBulkInsert()
Verify that bulkInsert is allowed on this table.
|
firstExecuteSpecialHandlingAutoGen, getAutoGeneratedKeysResultset, getCompactRow, saveAIcacheInformation, verifyAutoGeneratedRScolumnsList
decodeLockMode, getIndexNameFromCID, getResultDescription, makeDeferredSparseRow, modifiedRowCount, normalizeRow
addWarning, checkRowPosition, clearCurrentRow, close, doesCommit, evaluateGenerationClauses, getAbsoluteRow, getActivation, getBeginExecutionTimestamp, getCurrentTimeMillis, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getQueryPlanText, getRelativeRow, getRowNumber, getSubqueryTrackingArray, getTimeSpent, getWarnings, isClosed, returnsRows, setAfterLastRow, setBeforeFirstRow, setup, toXML
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addWarning, checkRowPosition, clearCurrentRow, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getRelativeRow, getResultDescription, getRowNumber, getSubqueryTrackingArray, getTimeSpent, getWarnings, isClosed, modifiedRowCount, returnsRows, setAfterLastRow, setBeforeFirstRow, toXML
NoPutResultSet savedSource
InsertConstantAction constants
private GeneratedMethod generationClauses
private GeneratedMethod checkGM
private long heapConglom
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<java.lang.Long,java.lang.Long> indexConversionTable
private FormatableBitSet indexedCols
private ConglomerateController bulkHeapCC
protected DataDictionary dd
protected TableDescriptor td
private ExecIndexRow[] indexRows
private final int fullTemplateId
private final java.lang.String schemaName
private final java.lang.String tableName
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 hasBeforeRowTrigger
private BulkTableScanResultSet tableScan
private int numOpens
private boolean firstExecute
private FKInfo[] fkInfoArray
private TriggerInfo triggerInfo
private RISetChecker fkChecker
private TriggerEventActivator triggerActivator
private BulkInsertCounter[] bulkInsertCounters
private BackingStoreHashtable deferredChecks
private java.util.List<UUID> violatingCheckConstraints
InsertResultSet(NoPutResultSet source, GeneratedMethod generationClauses, GeneratedMethod checkGM, int fullTemplate, java.lang.String schemaName, java.lang.String tableName, Activation activation) throws StandardException
StandardException
- Thrown on errorpublic void changedRow(ExecRow execRow, RowLocation rowLocation) throws StandardException
TargetResultSet
changedRow
in interface TargetResultSet
execRow
- 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 TargetResultSet
execRow
- The source row.StandardException
- thrown on errorpublic void offendingRowLocation(RowLocation rl, long constainerId) throws StandardException
offendingRowLocation
in interface TargetResultSet
StandardException
private boolean evaluateCheckConstraints() throws StandardException
StandardException
- thrown on errorpublic void open() throws StandardException
ResultSet
open
in interface ResultSet
StandardException
- Standard Derby error policypublic void close() throws StandardException
close
in interface ResultSet
StandardException
- Thrown on error.private int[] generatedColumnPositionsArray() throws StandardException
StandardException
public NumberDataValue getSetAutoincrementValue(int columnPosition, long increment) throws StandardException
getSetAutoincrementValue
in class DMLWriteGeneratedColumnsResultSet
columnPosition
- position of the column in the table (1-based)increment
- amount of increment.StandardException
- if anything goes wrong.private void getOldStyleBulkInsertValue(int index, long increment) throws StandardException
index
- 0-based index into aiCacheStandardException
private NumberDataValue getOldStyleIdentityValue(int index) throws StandardException
index
- 0-based index into aiCacheStandardException
private boolean isSourceRowResultSet()
private boolean isSingleRowResultSet()
private void normalInsertCore(LanguageConnectionContext lcc, boolean firstExecute) throws StandardException
StandardException
protected ExecRow getNextRowCore(NoPutResultSet source) throws StandardException
DMLWriteResultSet
getNextRowCore
in class DMLWriteResultSet
source
- SourceResultSet
Also look at Track#2432/change 12433StandardException
- Standard error policyprivate ExecRow processMergeRow(NoPutResultSet sourceRS, ExecRow row) throws StandardException
Special handling if this is an INSERT action of a MERGE statement.
StandardException
private void bulkInsertCore(LanguageConnectionContext lcc, ExecRow fullTemplate, long oldHeapConglom) throws StandardException
StandardException
private void bulkValidateForeignKeys(TransactionController tc, ContextManager cm, ExecRow fullTemplate) throws StandardException
StandardException
private void bulkValidateForeignKeysCore(TransactionController tc, ContextManager cm, FKInfo fkInfo, long fkConglom, long pkConglom, java.lang.String fkConstraintName, ExecRow fullTemplate) throws StandardException
StandardException
private ExecRow makeIndexTemplate(FKInfo fkInfo, ExecRow fullTemplate, ContextManager cm) throws StandardException
StandardException
private 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
ResultSet
cleanUp
in interface ResultSet
StandardException
- 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
StandardException
private java.lang.String[] getColumnNames(int[] baseColumnPositions)
public void finish() throws StandardException
ResultSet
finish
in interface ResultSet
finish
in class NoRowsResultSetImpl
StandardException
- on errorpublic void rememberConstraint(UUID cid) throws StandardException
rememberConstraint
in class DMLWriteResultSet
StandardException
protected void initializeAIcache(RowLocation[] rla) throws StandardException
StandardException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.