src/main/java/org/embulk/output/MySQLOutputPlugin.java in embulk-output-mysql-0.2.2 vs src/main/java/org/embulk/output/MySQLOutputPlugin.java in embulk-output-mysql-0.2.3

- old
+ new

@@ -1,18 +1,16 @@ package org.embulk.output; import java.util.Properties; import java.io.IOException; import java.sql.SQLException; -import java.sql.Connection; -import org.embulk.spi.Exec; + +import org.embulk.output.mysql.MySQLBatchUpsert; import org.embulk.config.Config; import org.embulk.config.ConfigDefault; import org.embulk.output.jdbc.AbstractJdbcOutputPlugin; -import org.embulk.output.jdbc.JdbcOutputConnection; import org.embulk.output.jdbc.BatchInsert; -import org.embulk.output.jdbc.JdbcOutputConnector; import org.embulk.output.mysql.MySQLOutputConnector; import org.embulk.output.mysql.MySQLBatchInsert; public class MySQLOutputPlugin extends AbstractJdbcOutputPlugin @@ -94,8 +92,9 @@ } @Override protected BatchInsert newBatchInsert(PluginTask task) throws IOException, SQLException { - return new MySQLBatchInsert(getConnector(task, true)); + MySQLOutputConnector connector = getConnector(task, true); + return task.getMode().isMerge() ? new MySQLBatchUpsert(connector) : new MySQLBatchInsert(connector); } }