src/main/java/org/embulk/input/MySQLInputPlugin.java in embulk-input-mysql-0.8.6 vs src/main/java/org/embulk/input/MySQLInputPlugin.java in embulk-input-mysql-0.9.0
- old
+ new
@@ -12,16 +12,14 @@
import org.embulk.config.Config;
import org.embulk.config.ConfigDefault;
import org.embulk.input.jdbc.AbstractJdbcInputPlugin;
import org.embulk.input.jdbc.Ssl;
-import org.embulk.input.jdbc.JdbcInputConnection;
import org.embulk.input.jdbc.getter.ColumnGetterFactory;
import org.embulk.input.mysql.MySQLInputConnection;
import org.embulk.input.mysql.getter.MySQLColumnGetterFactory;
import org.embulk.spi.PageBuilder;
-import org.embulk.spi.Schema;
import org.joda.time.DateTimeZone;
public class MySQLInputPlugin
extends AbstractJdbcInputPlugin
{
@@ -50,10 +48,14 @@
public String getDatabase();
@Config("ssl")
@ConfigDefault("\"disable\"") // backward compatibility
public Ssl getSsl();
+
+ @Config("use_legacy_datetime_code")
+ @ConfigDefault("false")
+ public boolean getUseLegacyDatetimeCode();
}
@Override
protected Class<? extends PluginTask> getTaskClass()
{
@@ -101,20 +103,24 @@
props.setProperty("requireSSL", "true");
props.setProperty("verifyServerCertificate", "true");
break;
}
+ // NOTE:The useLegacyDatetimeCode option is obsolete in the MySQL Connector/J 6.
+ props.setProperty("useLegacyDatetimeCode", String.valueOf(t.getUseLegacyDatetimeCode()));
+
if (t.getFetchRows() == 1) {
logger.info("Fetch size is 1. Fetching rows one by one.");
} else if (t.getFetchRows() <= 0) {
logger.info("Fetch size is set to -1. Fetching all rows at once.");
} else {
logger.info("Fetch size is {}. Using server-side prepared statement.", t.getFetchRows());
props.setProperty("useCursorFetch", "true");
}
props.putAll(t.getOptions());
+ logConnectionProperties(url, props);
// load timezone mappings
loadTimeZoneMappings();
Connection con = DriverManager.getConnection(url, props);
@@ -168,16 +174,8 @@
finally {
if (f != null) {
f.setAccessible(false);
}
}
- }
-
- @Override
- protected Schema setupTask(JdbcInputConnection con, PluginTask task) throws SQLException
- {
- MySQLInputConnection mySQLCon = (MySQLInputConnection)con;
- mySQLCon.compareTimeZone();
- return super.setupTask(con,task);
}
}