@Override protected void initializeBatch(String databaseName, String table) throws SQLException { super.initializeBatch(databaseName, table); this.columnPosSqlTypes = getColumnPosSqlTypes(); }
@Override public void flush() throws SQLException { this.jdbcBufferedWriter.flush(); }
@Override public Boolean call() throws Exception { return insertBatch(pstmt); } }).call();
/** * @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"); } }
@Override public void insert(String databaseName, String table, JdbcEntryData jdbcEntryData) throws SQLException { this.jdbcBufferedWriter.insert(databaseName, table, jdbcEntryData); }
public MySqlWriterCommands(State state, Connection conn) { this.conn = conn; this.jdbcBufferedWriter = new MySqlBufferedInserter(state, conn); }
public TeradataWriterCommands(State state, Connection conn) { this.conn = conn; this.jdbcBufferedWriter = new TeradataBufferedInserter(state, conn); }
@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); }
public JdbcWriterInitializer(State state, Collection<WorkUnit> workUnits) { this(state, workUnits, new JdbcWriterCommandsFactory(), 1, 0); }
@Override public void flush() throws SQLException { if (this.currBatchSize > 0) { insertBatch(this.insertPstmtForFixedBatch); } }
public PostgresWriterCommands(State state, Connection conn) { this.conn = conn; this.jdbcBufferedWriter = new PostgresBufferedInserter(state, conn); }
@Override public void flush() throws SQLException { this.jdbcBufferedWriter.flush(); }
@Override public void insert(String databaseName, String table, JdbcEntryData jdbcEntryData) throws SQLException { this.jdbcBufferedWriter.insert(databaseName, table, jdbcEntryData); }
@Override protected JdbcBufferedInserter getJdbcBufferedInserter(State state, Connection conn) { return new MySqlBufferedInserter(state, conn); } }
@Override protected JdbcBufferedInserter getJdbcBufferedInserter(State state, Connection conn) { return new TeradataBufferedInserter(state, conn); }
@Override public void deleteAll(String database, String table) throws SQLException { String deleteSql = String.format(DELETE_STATEMENT_FORMAT, database, table); execute(deleteSql); }
public AvroToJdbcEntryConverterInitializer(State state, Collection<WorkUnit> workUnits) { this(state, workUnits, new JdbcWriterCommandsFactory(), 1, 0); }
@Override public void flush() throws SQLException { this.jdbcBufferedWriter.flush(); }
@Override public void insert(String databaseName, String table, JdbcEntryData jdbcEntryData) throws SQLException { this.jdbcBufferedWriter.insert(databaseName, table, jdbcEntryData); }
@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); }