@Override public void createTableStructure(String databaseName, String fromStructure, String targetTableName) throws SQLException { String sql = String.format(CREATE_TABLE_SQL_FORMAT, databaseName, targetTableName, databaseName, fromStructure); execute(sql); }
/** * @param destination * @return Provides JdbcWriterCommands bases on destination. */ public JdbcWriterCommands newInstance(Destination destination, Connection conn) { switch (destination.getType()) { case MYSQL: return new MySqlWriterCommands(destination.getProperties(), conn); case TERADATA: return new TeradataWriterCommands(destination.getProperties(), conn); case POSTGRES: return new PostgresWriterCommands(destination.getProperties(), conn); default: throw new IllegalArgumentException(destination.getType() + " is not supported"); } }
/** * @param destination * @return Provides JdbcWriterCommands bases on destination. */ public JdbcWriterCommands newInstance(Destination destination, Connection conn) { switch (destination.getType()) { case MYSQL: return new MySqlWriterCommands(destination.getProperties(), conn); case TERADATA: return new TeradataWriterCommands(destination.getProperties(), conn); default: throw new IllegalArgumentException(destination.getType() + " is not supported"); } }
@Override public void truncate(String database, String table) throws SQLException { String sql = String.format(TRUNCATE_TABLE_FORMAT, database, table); execute(sql); }
@Override public void deleteAll(String database, String table) throws SQLException { String deleteSql = String.format(DELETE_STATEMENT_FORMAT, database, table); execute(deleteSql); }
@Override public void copyTable(String databaseName, String from, String to) throws SQLException { String sql = String.format(COPY_INSERT_STATEMENT_FORMAT, databaseName, to, databaseName, from); execute(sql); }
@Override public void drop(String database, String table) throws SQLException { LOG.info("Dropping table " + table); String sql = String.format(DROP_TABLE_SQL_FORMAT, database, table); execute(sql); }
@Override public void truncate(String database, String table) throws SQLException { String sql = String.format(TRUNCATE_TABLE_FORMAT, database, table); execute(sql); }
@Override public void deleteAll(String database, String table) throws SQLException { String deleteSql = String.format(DELETE_STATEMENT_FORMAT, database, table); execute(deleteSql); }
@Override public void createTableStructure(String databaseName, String fromStructure, String targetTableName) throws SQLException { String sql = String.format(CREATE_TABLE_SQL_FORMAT, databaseName, targetTableName, databaseName, fromStructure); execute(sql); }
@Override public void copyTable(String databaseName, String from, String to) throws SQLException { String sql = String.format(COPY_INSERT_STATEMENT_FORMAT, databaseName, to, databaseName, from); execute(sql); }
@Override public void drop(String database, String table) throws SQLException { LOG.info("Dropping table " + table); String sql = String.format(DROP_TABLE_SQL_FORMAT, database, table); execute(sql); }