Class Merge


  • public final class Merge
    extends CommandWithValues
    This class represents the statement MERGE or the MySQL compatibility statement REPLACE
    • Field Detail

      • isReplace

        private boolean isReplace
      • table

        private Table table
      • columns

        private Column[] columns
      • query

        private Query query
      • update

        private Update update
    • 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
      • setTable

        public void setTable​(Table table)
      • setColumns

        public void setColumns​(Column[] columns)
      • setKeys

        public void setKeys​(Column[] keys)
      • setQuery

        public void setQuery​(Query query)
      • merge

        private int merge​(Row row,
                          Expression[] expressions,
                          ResultTarget deltaChangeCollector,
                          DataChangeDeltaTable.ResultOption deltaChangeCollectionMode)
        Updates an existing row or inserts a new one.
        Parameters:
        row - row to replace
        expressions - source expressions, or null
        deltaChangeCollector - target result
        deltaChangeCollectionMode - collection mode
        Returns:
        1 if row was inserted, 1 if row was updated by a MERGE statement, and 2 if row was updated by a REPLACE statement
      • 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
      • prepare

        public void prepare()
        Description copied from class: Prepared
        Prepare this statement.
        Overrides:
        prepare in class Prepared
      • 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
      • 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