Class UpdateResultSet
- java.lang.Object
-
- org.apache.derby.impl.sql.execute.NoRowsResultSetImpl
-
- org.apache.derby.impl.sql.execute.DMLWriteResultSet
-
- org.apache.derby.impl.sql.execute.DMLWriteGeneratedColumnsResultSet
-
- org.apache.derby.impl.sql.execute.UpdateResultSet
-
- All Implemented Interfaces:
ResultSet
class UpdateResultSet extends DMLWriteGeneratedColumnsResultSet
Update the rows from 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 update plan.
-
-
Field Summary
-
Fields inherited from class org.apache.derby.impl.sql.execute.DMLWriteGeneratedColumnsResultSet
aiCache, autoGeneratedKeysColumnIndexes, autoGeneratedKeysResultSet, autoGeneratedKeysRowsHolder, autoincrementGenerated, identitySequenceUUIDString, identityVal, setIdentity, sourceResultSet
-
Fields inherited from class org.apache.derby.impl.sql.execute.DMLWriteResultSet
baseRowReadMap, cachedDestinations, constantAction, heapDCOCI, indexDCOCIs, resultDescription, rowCount, streamStorableHeapColIds
-
Fields inherited from class org.apache.derby.impl.sql.execute.NoRowsResultSetImpl
activation, beginExecutionTime, beginTime, endExecutionTime, endTime, lcc
-
Fields inherited from interface org.apache.derby.iapi.sql.ResultSet
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST
-
-
Constructor Summary
Constructors Constructor Description UpdateResultSet(NoPutResultSet source, GeneratedMethod generationClauses, GeneratedMethod checkGM, Activation activation)
UpdateResultSet(NoPutResultSet source, GeneratedMethod generationClauses, GeneratedMethod checkGM, Activation activation, int constantActionItem, int rsdItem)
UpdateResultSet(NoPutResultSet source, GeneratedMethod generationClauses, GeneratedMethod checkGM, Activation activation, ConstantAction passedInConstantAction, ResultDescription passedInRsd)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private FormatableBitSet
checkStreamCols()
void
cleanUp()
Tells the system to clean up on an error.void
close()
Tells the system that there will be no more calls to getNextRow() (until the next open() call), so it can free up the resources associated with the ResultSet.boolean
collectAffectedRows()
private boolean
evaluateCheckConstraints()
Run check constraints against the current row.(package private) void
fireAfterTriggers()
(package private) void
fireBeforeTriggers()
static boolean
foundRow(ExecRow checkRow, int[] colsToCheck, TemporaryRowHolderImpl rowHolder)
protected ExecRow
getNextRowCore(NoPutResultSet source)
Get next row from the source result set.NumberDataValue
getSetAutoincrementValue(int columnPosition, long increment)
getSetAutoincrementValue will get the autoincrement value of the columnPosition specified for the target table.protected void
initializeAIcache(RowLocation[] rla)
private void
notifyForUpdateCursor(DataValueDescriptor[] row, DataValueDescriptor[] newBaseRow, RowLocation rl, TableScanResultSet tableScan)
private void
objectifyStream(ExecRow tempRow, FormatableBitSet streamCols)
void
open()
Needs to be called before the result set will do anything.private ExecRow
processMergeRow(NoPutResultSet sourceRS, ExecRow row)
Special handling if this is an UPDATE action of a MERGE statement.void
rememberConstraint(UUID cid)
(package private) void
rowChangerFinish()
(package private) void
runChecker(boolean restrictCheckOnly)
(package private) void
setup()
Set up the result set for use.(package private) void
updateDeferredRows()
-
Methods inherited from class org.apache.derby.impl.sql.execute.DMLWriteGeneratedColumnsResultSet
firstExecuteSpecialHandlingAutoGen, getAutoGeneratedKeysResultset, getCompactRow, saveAIcacheInformation, verifyAutoGeneratedRScolumnsList
-
Methods inherited from class org.apache.derby.impl.sql.execute.DMLWriteResultSet
decodeLockMode, getIndexNameFromCID, getResultDescription, makeDeferredSparseRow, modifiedRowCount, normalizeRow
-
Methods inherited from class org.apache.derby.impl.sql.execute.NoRowsResultSetImpl
addWarning, checkRowPosition, clearCurrentRow, close, doesCommit, evaluateGenerationClauses, finish, getAbsoluteRow, getActivation, getBeginExecutionTimestamp, getCurrentTimeMillis, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getQueryPlanText, getRelativeRow, getRowNumber, getSubqueryTrackingArray, getTimeSpent, getWarnings, isClosed, returnsRows, setAfterLastRow, setBeforeFirstRow, toXML
-
-
-
-
Field Detail
-
tc
private TransactionController tc
-
newBaseRow
private ExecRow newBaseRow
-
row
private ExecRow row
-
deferredSparseRow
private ExecRow deferredSparseRow
-
constants
UpdateConstantAction constants
-
savedSource
NoPutResultSet savedSource
-
rowChanger
private RowChanger rowChanger
-
deferredBaseCC
protected ConglomerateController deferredBaseCC
-
deferredUniqueCIDs
protected long[] deferredUniqueCIDs
-
deferredUniqueCreated
protected boolean[] deferredUniqueCreated
-
deferredUniqueCC
protected ConglomerateController[] deferredUniqueCC
-
deferredUniqueScans
protected ScanController[] deferredUniqueScans
-
deletedRowHolder
private TemporaryRowHolderImpl deletedRowHolder
-
insertedRowHolder
private TemporaryRowHolderImpl insertedRowHolder
-
riChecker
private RISetChecker riChecker
-
triggerInfo
private TriggerInfo triggerInfo
-
triggerActivator
private TriggerEventActivator triggerActivator
-
updatingReferencedKey
private boolean updatingReferencedKey
-
updatingForeignKey
private boolean updatingForeignKey
-
numOpens
private int numOpens
-
heapConglom
private long heapConglom
-
fkInfoArray
private FKInfo[] fkInfoArray
-
baseRowReadList
private FormatableBitSet baseRowReadList
-
generationClauses
private GeneratedMethod generationClauses
-
checkGM
private GeneratedMethod checkGM
-
resultWidth
private int resultWidth
-
numberOfBaseColumns
private int numberOfBaseColumns
-
deferredTempRow
private ExecRow deferredTempRow
-
deferredBaseRow
private ExecRow deferredBaseRow
-
oldDeletedRow
private ExecRow oldDeletedRow
-
triggerResultDescription
private ResultDescription triggerResultDescription
-
lockMode
int lockMode
-
deferred
boolean deferred
-
beforeUpdateCopyRequired
boolean beforeUpdateCopyRequired
-
violatingCheckConstraints
private java.util.List<UUID> violatingCheckConstraints
-
deferredChecks
private BackingStoreHashtable deferredChecks
-
-
Constructor Detail
-
UpdateResultSet
UpdateResultSet(NoPutResultSet source, GeneratedMethod generationClauses, GeneratedMethod checkGM, Activation activation) throws StandardException
- Parameters:
source
- update rows come from sourcegenerationClauses
- Generated method for computed generation clausescheckGM
- Generated method for enforcing check constraintsactivation
- The activation- Throws:
StandardException
- thrown on error
-
UpdateResultSet
UpdateResultSet(NoPutResultSet source, GeneratedMethod generationClauses, GeneratedMethod checkGM, Activation activation, int constantActionItem, int rsdItem) throws StandardException
- Parameters:
source
- update rows come from sourcegenerationClauses
- Generated method for computed generation clausescheckGM
- Generated method for enforcing check constraintsactivation
- ActivationconstantActionItem
- id of the update constant action saved objectrsdItem
- id of the Result Description saved object- Throws:
StandardException
- thrown on error
-
UpdateResultSet
UpdateResultSet(NoPutResultSet source, GeneratedMethod generationClauses, GeneratedMethod checkGM, Activation activation, ConstantAction passedInConstantAction, ResultDescription passedInRsd) throws StandardException
- Parameters:
source
- update rows come from sourcegenerationClauses
- Generated method for computed generation clausescheckGM
- Generated method for enforcing check constraintsactivation
-passedInConstantAction
-passedInRsd
-- Throws:
StandardException
- thrown on error
-
-
Method Detail
-
open
public void open() throws StandardException
Description copied from interface:ResultSet
Needs to be called before the result set will do anything. Need to call before getNextRow(), or for a result set that doesn't return rows, this is the call that will cause all the work to be done.- Throws:
StandardException
- Standard Derby error policy
-
setup
void setup() throws StandardException
Description copied from class:NoRowsResultSetImpl
Set up the result set for use. Should always be called fromopen()
.- Overrides:
setup
in classNoRowsResultSetImpl
- Throws:
StandardException
- Standard Derby error policy
-
checkStreamCols
private FormatableBitSet checkStreamCols()
-
objectifyStream
private void objectifyStream(ExecRow tempRow, FormatableBitSet streamCols) throws StandardException
- Throws:
StandardException
-
evaluateCheckConstraints
private boolean evaluateCheckConstraints() throws StandardException
Run check constraints against the current row. Raise an error if a check constraint is violated, unless all the offending checks are deferred, in which case a false value will be returned. A NULL value will be interpreted as success (not violation).- Throws:
StandardException
- thrown on error
-
collectAffectedRows
public boolean collectAffectedRows() throws StandardException
- Throws:
StandardException
-
getNextRowCore
protected ExecRow getNextRowCore(NoPutResultSet source) throws StandardException
Description copied from class:DMLWriteResultSet
Get next row from the source result set.- Overrides:
getNextRowCore
in classDMLWriteResultSet
- Parameters:
source
- SourceResultSet Also look at Track#2432/change 12433- Returns:
- The next row in the result set
- Throws:
StandardException
- Standard error policy
-
processMergeRow
private ExecRow processMergeRow(NoPutResultSet sourceRS, ExecRow row) throws StandardException
Special handling if this is an UPDATE action of a MERGE statement.
- Throws:
StandardException
-
notifyForUpdateCursor
private void notifyForUpdateCursor(DataValueDescriptor[] row, DataValueDescriptor[] newBaseRow, RowLocation rl, TableScanResultSet tableScan) throws StandardException
- Throws:
StandardException
-
fireBeforeTriggers
void fireBeforeTriggers() throws StandardException
- Throws:
StandardException
-
fireAfterTriggers
void fireAfterTriggers() throws StandardException
- Throws:
StandardException
-
updateDeferredRows
void updateDeferredRows() throws StandardException
- Throws:
StandardException
-
runChecker
void runChecker(boolean restrictCheckOnly) throws StandardException
- Throws:
StandardException
-
foundRow
public static boolean foundRow(ExecRow checkRow, int[] colsToCheck, TemporaryRowHolderImpl rowHolder) throws StandardException
- Throws:
StandardException
-
cleanUp
public void cleanUp() throws StandardException
Description copied from interface:ResultSet
Tells the system to clean up on an error.- Throws:
StandardException
- Thrown on error- See Also:
ResultSet.cleanUp()
-
close
public void close() throws StandardException
Description copied from interface:ResultSet
Tells the system that there will be no more calls to getNextRow() (until the next open() call), so it can free up the resources associated with the ResultSet.- Throws:
StandardException
- Thrown on error.
-
rowChangerFinish
void rowChangerFinish() throws StandardException
- Throws:
StandardException
-
rememberConstraint
public void rememberConstraint(UUID cid) throws StandardException
- Overrides:
rememberConstraint
in classDMLWriteResultSet
- Throws:
StandardException
-
getSetAutoincrementValue
public NumberDataValue getSetAutoincrementValue(int columnPosition, long increment) throws StandardException
getSetAutoincrementValue will get the autoincrement value of the columnPosition specified for the target table. If increment is non-zero we will also update the autoincrement value.- Overrides:
getSetAutoincrementValue
in classDMLWriteGeneratedColumnsResultSet
- Parameters:
columnPosition
- position of the column in the table (1-based)increment
- amount of increment.- Throws:
StandardException
- if anything goes wrong.
-
initializeAIcache
protected void initializeAIcache(RowLocation[] rla) throws StandardException
- Throws:
StandardException
-
-