Package org.h2.command.dml
Class MergeUsing
java.lang.Object
org.h2.command.Prepared
org.h2.command.dml.DataChangeStatement
org.h2.command.dml.MergeUsing
This class represents the statement syntax
MERGE INTO table alias USING...
It does not replace the MERGE INTO... KEYS... form.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Abstract WHEN command of the MERGE statement.final class
final class
final class
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) Expression
ON condition expression.(package private) TableFilter
Source table filter.Contains _ROWID_ of processed rows.(package private) TableFilter
Target table filter.private ArrayList
<MergeUsing.When> Fields inherited from class org.h2.command.Prepared
create, parameters, prepareAlways, session, sqlStatement, sqlTokens
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds WHEN command.private void
void
collectDependencies
(HashSet<DbObject> dependencies) Find and collect all DbObjects, this Prepared depends on.private int
getPlanSQL
(int sqlFlags) Get the SQL statement with the execution plan.Return the name of this statement.getTable()
Return the target table.int
getType()
Get the command type as defined in CommandInterfacegetWhen()
private int
merge
(boolean nullRow, ResultTarget deltaChangeCollector, DataChangeDeltaTable.ResultOption deltaChangeCollectionMode) void
prepare()
Prepare this statement.void
setOnCondition
(Expression condition) void
setSourceTableFilter
(TableFilter sourceTableFilter) void
setTargetTableFilter
(TableFilter targetTableFilter) long
update
(ResultTarget deltaChangeCollector, DataChangeDeltaTable.ResultOption deltaChangeCollectionMode) Execute the statement with specified delta change collector and collection mode.Methods inherited from class org.h2.command.dml.DataChangeStatement
isCacheable, isTransactional, queryMeta, update
Methods inherited from class org.h2.command.Prepared
checkCanceled, checkParameters, getCteCleanups, getCurrentRowNumber, getObjectId, getParameters, getPersistedObjectId, getSession, getSimpleSQL, getSQL, getSQLTokens, isQuery, isReadOnly, needRecompile, query, setCommand, setCteCleanups, setCurrentRowNumber, setParameterList, setPersistedObjectId, setPrepareAlways, setRow, setSession, setSQL, toString
-
Field Details
-
targetTableFilter
TableFilter targetTableFilterTarget table filter. -
sourceTableFilter
TableFilter sourceTableFilterSource table filter. -
onCondition
Expression onConditionON condition expression. -
when
-
targetRowidsRemembered
Contains _ROWID_ of processed rows. Row identities are remembered to prevent duplicate updates of the same row.
-
-
Constructor Details
-
MergeUsing
-
-
Method Details
-
update
public long update(ResultTarget deltaChangeCollector, DataChangeDeltaTable.ResultOption deltaChangeCollectionMode) Description copied from class:DataChangeStatement
Execute the statement with specified delta change collector and collection mode.- Specified by:
update
in classDataChangeStatement
- Parameters:
deltaChangeCollector
- target resultdeltaChangeCollectionMode
- collection mode- Returns:
- the update count
-
merge
private int merge(boolean nullRow, ResultTarget deltaChangeCollector, DataChangeDeltaTable.ResultOption deltaChangeCollectionMode) -
evaluateTriggerMasks
private int evaluateTriggerMasks() -
checkRights
private void checkRights() -
getPlanSQL
Description copied from class:Prepared
Get the SQL statement with the execution plan.- Overrides:
getPlanSQL
in classPrepared
- Parameters:
sqlFlags
- formatting flags- Returns:
- the execution plan
-
prepare
public void prepare()Description copied from class:Prepared
Prepare this statement. -
setSourceTableFilter
-
getSourceTableFilter
-
setOnCondition
-
getOnCondition
-
getWhen
-
addWhen
Adds WHEN command.- Parameters:
w
- new WHEN command to add (update, delete or insert).
-
getTable
Description copied from class:DataChangeStatement
Return the target table.- Specified by:
getTable
in classDataChangeStatement
- Returns:
- the target table
-
setTargetTableFilter
-
getTargetTableFilter
-
getType
public int getType()Description copied from class:Prepared
Get the command type as defined in CommandInterface -
getStatementName
Description copied from class:DataChangeStatement
Return the name of this statement.- Specified by:
getStatementName
in classDataChangeStatement
- Returns:
- the short name of this statement.
-
collectDependencies
Description copied from class:Prepared
Find and collect all DbObjects, this Prepared depends on.- Overrides:
collectDependencies
in classPrepared
- Parameters:
dependencies
- collection of dependencies to populate
-