|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.sql.execute.NoRowsResultSetImpl
org.apache.derby.impl.sql.execute.DMLWriteResultSet
org.apache.derby.impl.sql.execute.InsertResultSet
Insert the rows from the source into the specified base table. This will cause constraints to be checked and triggers to be executed based on the c's and t's compiled into the insert plan.
Nested Class Summary | |
(package private) class |
InsertResultSet.MyRowAllocator
|
Fields inherited from interface org.apache.derby.iapi.sql.ResultSet |
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST |
Constructor Summary | |
InsertResultSet(NoPutResultSet source,
GeneratedMethod checkGM,
Activation activation)
|
Method Summary | |
private long |
bulkInsertCore(LanguageConnectionContext lcc,
long oldHeapConglom)
|
private void |
bulkValidateForeignKeys(TransactionController tc,
ContextManager cm)
|
private void |
bulkValidateForeignKeysCore(TransactionController tc,
ContextManager cm,
FKInfo fkInfo,
long fkConglom,
long pkConglom,
java.lang.String fkConstraintName)
|
void |
changedRow(ExecRow execRow,
RowLocation rowLocation)
Pass a changed row and the row location for that row to the target result set. |
boolean |
checkRowPosition(int isType)
Determine if the cursor is before the first row in the result set. |
void |
cleanUp()
Tells the system to clean up on an error. |
void |
close()
No rows to return, does nothing |
boolean |
doesCommit()
Does this ResultSet cause a commit or rollback. |
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. |
static void |
evaluateACheckConstraint(GeneratedMethod checkGM,
java.lang.String checkName,
long heapConglom,
Activation activation)
Run a check constraint against the current row. |
private void |
evaluateCheckConstraints()
Run the check constraints against the current row. |
static void |
evaluateCheckConstraints(GeneratedMethod checkGM,
Activation activation)
Run 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()
|
ExecRow |
getAbsoluteRow(int row)
Returns the row at the absolute position from the query, and returns NULL when there is no such position. |
ResultSet |
getAutoGeneratedKeysResultset()
ResultSet for rows inserted into the table (contains auto-generated keys columns only) |
java.sql.Timestamp |
getBeginExecutionTimestamp()
Get the Timestamp for the beginning of execution. |
private java.lang.String[] |
getColumnNames(int[] baseColumnPositions)
|
private ExecRow |
getCompactRow(ExecRow inputRow,
int[] columnIndexes)
|
protected long |
getCurrentTimeMillis()
Return the current time in milliseconds, if DEBUG and RunTimeStats is on, else return 0. |
java.lang.String |
getCursorName()
Return the cursor name, null in this case. |
java.sql.Timestamp |
getEndExecutionTimestamp()
Get the Timestamp for the end of execution. |
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). |
long |
getExecuteTime()
Get the execution time in milliseconds. |
ExecRow |
getFirstRow()
Returns the first row from the query, and returns NULL when there are no rows. |
(package private) java.lang.String |
getIndexNameFromCID(long indexCID)
get the index name given the conglomerate id of the index. |
ExecRow |
getLastRow()
Returns the last row from the query, and returns NULL when there are no rows. |
ExecRow |
getNextRow()
No rows to return, so throw an exception. |
protected ExecRow |
getNextRowCore(NoPutResultSet source)
Get next row from the source result set. |
ExecRow |
getPreviousRow()
Returns the previous row from the query, and returns NULL when there are no more previous rows. |
java.lang.String |
getQueryPlanText(int depth)
RESOLVE - This method will go away once it is overloaded in all subclasses. |
ExecRow |
getRelativeRow(int row)
Returns the row at the relative position from the current cursor position, and returns NULL when there is no such position. |
ResultDescription |
getResultDescription()
Returns the description of the inserted rows. |
int |
getRowNumber()
Returns the row number of the current row. |
NumberDataValue |
getSetAutoincrementValue(int columnPosition,
long increment)
getSetAutoincrementValue will get the autoincrement value of the columnPosition specified for the target table. |
NoPutResultSet[] |
getSubqueryTrackingArray(int numSubqueries)
Get the subquery ResultSet tracking array from the top ResultSet. |
private BulkTableScanResultSet |
getTableScanResultSet(long conglomId)
Get me a table scan result set, preferably a bulk table scan, thank you. |
long |
getTimeSpent(int type)
Return the total amount of time spent in this ResultSet |
java.sql.SQLWarning |
getWarnings()
Return the set of warnings generated during the execution of this result set. |
boolean |
isClosed()
Just report that it is always closed. |
private boolean |
isSourceRowResultSet()
|
protected ExecRow |
makeDeferredSparseRow(ExecRow deferredBaseRow,
FormatableBitSet baseRowReadList,
LanguageConnectionContext lcc)
For deferred update, get a deferred sparse row based on the deferred non-sparse row. |
private ExecRow |
makeIndexTemplate(FKInfo fkInfo,
ExecRow fullTemplate,
ContextManager cm)
Make a template row with the correct columns. |
int |
modifiedRowCount()
Returns the number of rows affected by the statement. |
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. |
boolean |
returnsRows()
Returns FALSE |
ExecRow |
setAfterLastRow()
Sets the current position to after the last row and returns NULL because there is no current row. |
ExecRow |
setBeforeFirstRow()
Sets the current position to before the first row and returns NULL because there is no current 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)
|
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 void |
verifyAutoGeneratedColumnsIndexes(int[] columnIndexes)
|
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.derby.iapi.sql.ResultSet |
checkRowPosition, close, getAbsoluteRow, getBeginExecutionTimestamp, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getRelativeRow, getRowNumber, getSubqueryTrackingArray, getTimeSpent, getWarnings, isClosed, modifiedRowCount, returnsRows, setAfterLastRow, setBeforeFirstRow |
Field Detail |
private NoPutResultSet sourceResultSet
public NoPutResultSet savedSource
public InsertConstantAction constants
private GeneratedMethod checkGM
private long heapConglom
public ResultSet autoGeneratedKeysResultSet
private TemporaryRowHolderImpl autoGeneratedKeysRowsHolder
public ResultDescription resultDescription
private RowChanger rowChanger
public TransactionController tc
public ExecRow row
public LanguageConnectionContext lcc
public boolean userSpecifiedBulkInsert
public 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 ExecRow fullTemplate
private long[] sortIds
private RowLocationRetRowSource[] rowSources
private ScanController bulkHeapSC
private ColumnOrdering[][] ordering
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
protected WriteCursorConstantAction constantAction
protected int[] baseRowReadMap
protected int[] streamStorableHeapColIds
protected ExecRow deferredSparseRow
protected DynamicCompiledOpenConglomInfo heapDCOCI
protected DynamicCompiledOpenConglomInfo[] indexDCOCIs
public int rowCount
protected final Activation activation
protected NoPutResultSet[] subqueryTrackingArray
protected java.lang.String indent
protected java.lang.String subIndent
protected int sourceDepth
protected long beginTime
protected long endTime
protected long beginExecutionTime
protected long endExecutionTime
Constructor Detail |
public InsertResultSet(NoPutResultSet source, GeneratedMethod checkGM, Activation activation) throws StandardException
StandardException
- Thrown on errorMethod Detail |
public ResultDescription getResultDescription()
getResultDescription
in interface ResultSet
getResultDescription
in class NoRowsResultSetImpl
public 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 errorprivate void evaluateCheckConstraints() throws StandardException
StandardException
- thrown on errorpublic void open() throws StandardException
ResultSet
open
in interface ResultSet
StandardException
- Standard Cloudscape error policyprivate void verifyAutoGeneratedColumnsIndexes(int[] columnIndexes) throws StandardException
StandardException
private int[] generatedColumnPositionsArray() throws StandardException
StandardException
private int[] uniqueColumnPositionArray(int[] columnIndexes) throws StandardException
StandardException
private void verifyAutoGeneratedColumnsNames(java.lang.String[] columnNames) throws StandardException
StandardException
- Thrown on error if invalid column
name in the list.public ResultSet getAutoGeneratedKeysResultset()
ResultSet
getAutoGeneratedKeysResultset
in interface ResultSet
getAutoGeneratedKeysResultset
in class NoRowsResultSetImpl
ResultSet.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 void normalInsertCore(LanguageConnectionContext lcc, boolean firstExecute) throws StandardException
StandardException
private ExecRow getCompactRow(ExecRow inputRow, int[] columnIndexes) throws StandardException
StandardException
private long bulkInsertCore(LanguageConnectionContext lcc, long oldHeapConglom) throws StandardException
StandardException
private void bulkValidateForeignKeys(TransactionController tc, ContextManager cm) throws StandardException
StandardException
private void bulkValidateForeignKeysCore(TransactionController tc, ContextManager cm, FKInfo fkInfo, long fkConglom, long pkConglom, java.lang.String fkConstraintName) 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 heap
StandardException
- 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 final int modifiedRowCount()
NoRowsResultSetImpl
modifiedRowCount
in interface ResultSet
modifiedRowCount
in class NoRowsResultSetImpl
protected ExecRow getNextRowCore(NoPutResultSet source) throws StandardException
source
- SourceResultSet
Also look at Track#2432/change 12433
StandardException
protected ExecRow makeDeferredSparseRow(ExecRow deferredBaseRow, FormatableBitSet baseRowReadList, LanguageConnectionContext lcc) throws StandardException
StandardException
- Thrown on errorjava.lang.String getIndexNameFromCID(long indexCID)
indexCID
- conglomerate ID of the index.
public final boolean returnsRows()
returnsRows
in interface ResultSet
public ExecRow getAbsoluteRow(int row) throws StandardException
getAbsoluteRow
in interface ResultSet
row
- The position.
StandardException
- Thrown on failureRow
public ExecRow getRelativeRow(int row) throws StandardException
getRelativeRow
in interface ResultSet
row
- The position.
StandardException
- Thrown on failureRow
public ExecRow setBeforeFirstRow() throws StandardException
setBeforeFirstRow
in interface ResultSet
StandardException
- Thrown on failureRow
public ExecRow getFirstRow() throws StandardException
getFirstRow
in interface ResultSet
StandardException
- Thrown on failureRow
public ExecRow getNextRow() throws StandardException
getNextRow
in interface ResultSet
StandardException
- Always throws a
StandardException to indicate
that this method is not intended to
be used.Row
public ExecRow getPreviousRow() throws StandardException
getPreviousRow
in interface ResultSet
StandardException
- Thrown on failureRow
public ExecRow getLastRow() throws StandardException
getLastRow
in interface ResultSet
StandardException
- Thrown on failureRow
public ExecRow setAfterLastRow() throws StandardException
setAfterLastRow
in interface ResultSet
StandardException
- Thrown on failureRow
public boolean checkRowPosition(int isType)
checkRowPosition
in interface ResultSet
public int getRowNumber()
getRowNumber
in interface ResultSet
public void close() throws StandardException
close
in interface ResultSet
StandardException
- thrown on errorpublic boolean isClosed()
isClosed
in interface ResultSet
public long getExecuteTime()
getExecuteTime
in interface ResultSet
public java.sql.Timestamp getBeginExecutionTimestamp()
getBeginExecutionTimestamp
in interface ResultSet
public java.sql.Timestamp getEndExecutionTimestamp()
getEndExecutionTimestamp
in interface ResultSet
public java.lang.String getQueryPlanText(int depth)
depth
- Indentation level.
public long getTimeSpent(int type)
getTimeSpent
in interface ResultSet
type
- CURRENT_RESULTSET_ONLY - time spent only in this ResultSet
ENTIRE_RESULTSET_TREE - time spent in this ResultSet and below.
public final NoPutResultSet[] getSubqueryTrackingArray(int numSubqueries)
ResultSet
getSubqueryTrackingArray
in interface ResultSet
numSubqueries
- The size of the array (For allocation on demand.)
ResultSet.getSubqueryTrackingArray(int)
public java.lang.String getCursorName()
getCursorName
in interface ResultSet
ResultSet.getCursorName()
protected final long getCurrentTimeMillis()
public static void evaluateACheckConstraint(GeneratedMethod checkGM, java.lang.String checkName, long heapConglom, Activation activation) throws StandardException
checkGM
- Generated code to run the check constraint.checkName
- Name of the constraint to check.heapConglom
- Number of heap conglomerate.
StandardException
- thrown on errorpublic static void evaluateCheckConstraints(GeneratedMethod checkGM, Activation activation) throws StandardException
checkGM
- Generated code to run the check constraint.
StandardException
- thrown on errorpublic boolean doesCommit()
public java.sql.SQLWarning getWarnings()
ResultSet
getWarnings
in interface ResultSet
|
Built on Tue 2006-10-10 19:23:47+0200, from revision exported | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |