org.h2.command.dml

## Class Merge

- java.lang.Object
- - org.h2.command.Prepared
  - - org.h2.command.dml.DataChangeStatement
    - - org.h2.command.dml.CommandWithValues
      - - org.h2.command.dml.Merge

    public final class Merge
    extends CommandWithValues

This class represents the statement MERGE or the MySQL compatibility statement REPLACE

### Field Summary

### Fields inherited from class org.h2.command.dml.CommandWithValues

`valuesExpressionList`

### Fields inherited from class org.h2.command.Prepared

`create, parameters, prepareAlways, session, sqlStatement, sqlTokens`

### Constructor Summary

Constructors
Constructor and Description
`Merge(SessionLocal session, boolean isReplace)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `collectDependencies(java.util.HashSet<DbObject> dependencies)` Find and collect all DbObjects, this Prepared depends on.
`java.lang.String` `getPlanSQL(int sqlFlags)` Get the SQL statement with the execution plan.
`java.lang.String` `getStatementName()` Return the name of this statement.
`Table` `getTable()` Return the target table.
`int` `getType()` Get the command type as defined in CommandInterface
`void` `setColumns(Column[] columns)`
`void` `setCommand(Command command)` Set the command.
`void` `setKeys(Column[] keys)`
`void` `setQuery(Query query)`
`void` `setTable(Table table)`
`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.CommandWithValues

`addRow`

### Methods inherited from class org.h2.command.dml.DataChangeStatement

`isCacheable, isTransactional, prepare, 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, setCteCleanups, setCurrentRowNumber, setParameterList, setPersistedObjectId, setPrepareAlways, setRow, setSession, setSQL, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### Merge

    public Merge(SessionLocal session,
                 boolean isReplace)

### Method Detail

#### setCommand

    public void setCommand(Command command)

Description copied from class: `Prepared`
Set the command.

Overrides:
  `setCommand` in class `Prepared`
Parameters:
  `command` - the new command

#### getTable

    public Table getTable()

Description copied from class: `DataChangeStatement`
Return the target table.

Specified by:
  `getTable` in class `DataChangeStatement`
Returns:
  the target table

#### setTable

    public void setTable(Table table)

#### setColumns

    public void setColumns(Column[] columns)

#### setKeys

    public void setKeys(Column[] keys)

#### setQuery

    public void setQuery(Query query)

#### 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 class `DataChangeStatement`
Parameters:
  `deltaChangeCollector` - target result
  `deltaChangeCollectionMode` - collection mode
Returns:
  the update count

#### getPlanSQL

    public java.lang.String getPlanSQL(int sqlFlags)

Description copied from class: `Prepared`
Get the SQL statement with the execution plan.

Overrides:
  `getPlanSQL` in class `Prepared`
Parameters:
  `sqlFlags` - formatting flags
Returns:
  the execution plan

#### getType

    public int getType()

Description copied from class: `Prepared`
Get the command type as defined in CommandInterface

Specified by:
  `getType` in class `Prepared`
Returns:
  the statement type

#### getStatementName

    public java.lang.String getStatementName()

Description copied from class: `DataChangeStatement`
Return the name of this statement.

Specified by:
  `getStatementName` in class `DataChangeStatement`
Returns:
  the short name of this statement.

#### collectDependencies

    public void collectDependencies(java.util.HashSet<DbObject> dependencies)

Description copied from class: `Prepared`
Find and collect all DbObjects, this Prepared depends on.

Overrides:
  `collectDependencies` in class `Prepared`
Parameters:
  `dependencies` - collection of dependencies to populate