@Test public void empty() throws Exception { try (Connection conn = h2.open()) { JdbcScript<Pair> script = new JdbcScript<>( "testing", new PairSupport(), "PAIR", Arrays.asList("KEY", "VALUE"), null); try (JdbcDrainDriver<Pair> driver = new JdbcDrainDriver<>(profile(), script, conn, true)) { driver.prepare(); } test(); } }
@Override public void prepare() throws IOException { LOG.debug("Preparing JDBC resource drain (resource={}, table={})", profile.getResourceName(), script.getTableName()); try { if (truncateOnPrepare) { truncate(); } } catch (SQLException e) { sawError = true; for (SQLException ex = e; ex != null; ex = ex.getNextException()) { WGLOG.error(ex, "E04001", profile.getResourceName(), script.getName(), script.getTableName()); } throw new IOException(MessageFormat.format( "Failed to prepare JDBC drain (resource={0}, table={1}, columns={2})", profile.getResourceName(), script.getTableName(), script.getColumnNames()), e); } try { this.statement = prepareStatement(); } catch (SQLException e) { sawError = true; for (SQLException ex = e; ex != null; ex = ex.getNextException()) { WGLOG.error(ex, "E04002", profile.getResourceName(), script.getName(), script.getTableName(), script.getColumnNames()); } throw new IOException(MessageFormat.format( "Failed to prepare JDBC drain (resource={0}, table={1}, columns={2})", profile.getResourceName(), script.getTableName(), script.getColumnNames()), e); } LOG.debug("Creating PreparedStatement support {} for {}", script.getSupport().getClass().getName(), script.getColumnNames()); support = script.getSupport().createPreparedStatementSupport(statement, script.getColumnNames()); putLimitRest = batchPutUnit; }
JdbcDrainDriver implements DrainDriver<T> { @Override public void prepare() throws IOException { LOG.debug("Preparing JDBC resource drain (resource={}, table={})", profile.getResourceName(), script.getTableName()); try { if (truncateOnPrepare) { truncate(); } } catch (SQLException e) { sawError = true; for (SQLException ex = e; ex != null; ex = ex.getNextException()) { WGLOG.error(ex, "E04001", profile.getResourceName(), script.getName(), script.getTableName()); } throw new IOException(MessageFormat.format( "Failed to prepare JDBC drain (resource={0}, table={1}, columns={2})", profile.getResourceName(), script.getTableName(), script.getColumnNames()), e); } try { this.statement = prepareStatement(); } catch (SQLException e) { sawError = true; for (SQLException ex = e; ex != null; ex = ex.getNextException()) { WGLOG.error(ex, "E04002", profile.getResourceName(), script.getName(), script.getTableName(), script.getColumnNames()); } throw new IOException(MessageFormat.format( "Failed to prepare JDBC drain (resource={0}, table={1}, columns={2})", profile.getResourceName(), script.getTableName(), script.getColumnNames()), e); } LOG.debug("Creating PreparedStatement support {} for {}", script.getSupport().getClass().getName(), script.getColumnNames()); support = script.getSupport().createPreparedStatementSupport(statement, script.getColumnNames()); putLimitRest = batchPutUnit; } }
JdbcDrainDriver implements DrainDriver<T> { @Override public void prepare() throws IOException { LOG.debug("Preparing JDBC resource drain (resource={}, table={})", profile.getResourceName(), script.getTableName()); try { if (truncateOnPrepare) { truncate(); } } catch (SQLException e) { sawError = true; for (SQLException ex = e; ex != null; ex = ex.getNextException()) { WGLOG.error(ex, "E04001", profile.getResourceName(), script.getName(), script.getTableName()); } throw new IOException(MessageFormat.format( "Failed to prepare JDBC drain (resource={0}, table={1}, columns={2})", profile.getResourceName(), script.getTableName(), script.getColumnNames()), e); } try { this.statement = prepareStatement(); } catch (SQLException e) { sawError = true; for (SQLException ex = e; ex != null; ex = ex.getNextException()) { WGLOG.error(ex, "E04002", profile.getResourceName(), script.getName(), script.getTableName(), script.getColumnNames()); } throw new IOException(MessageFormat.format( "Failed to prepare JDBC drain (resource={0}, table={1}, columns={2})", profile.getResourceName(), script.getTableName(), script.getColumnNames()), e); } LOG.debug("Creating PreparedStatement support {} for {}", script.getSupport().getClass().getName(), script.getColumnNames()); support = script.getSupport().createPreparedStatementSupport(statement, script.getColumnNames()); putLimitRest = batchPutUnit; } JdbcDrainDriver(
            JdbcProfile profile,
            JdbcScript<T> script,
            Connection connection,
            boolean truncateOnPrepare); }
JdbcDrainDriver implements DrainDriver<T> { @Override public void prepare() throws IOException { LOG.debug("Preparing JDBC resource drain (resource={}, table={})", profile.getResourceName(), script.getTableName()); try { if (truncateOnPrepare) { truncate(); } } catch (SQLException e) { sawError = true; for (SQLException ex = e; ex != null; ex = ex.getNextException()) { WGLOG.error(ex, "E04001", profile.getResourceName(), script.getName(), script.getTableName()); } throw new IOException(MessageFormat.format( "Failed to prepare JDBC drain (resource={0}, table={1}, columns={2})", profile.getResourceName(), script.getTableName(), script.getColumnNames()), e); } try { this.statement = prepareStatement(); } catch (SQLException e) { sawError = true; for (SQLException ex = e; ex != null; ex = ex.getNextException()) { WGLOG.error(ex, "E04002", profile.getResourceName(), script.getName(), script.getTableName(), script.getColumnNames()); } throw new IOException(MessageFormat.format( "Failed to prepare JDBC drain (resource={0}, table={1}, columns={2})", profile.getResourceName(), script.getTableName(), script.getColumnNames()), e); } LOG.debug("Creating PreparedStatement support {} for {}", script.getSupport().getClass().getName(), script.getColumnNames()); support = script.getSupport().createPreparedStatementSupport(statement, script.getColumnNames()); putLimitRest = batchPutUnit; } JdbcDrainDriver(
            JdbcProfile profile,
            JdbcScript<T> script,
            Connection connection,
            boolean truncateOnPrepare); @Override void prepare(); @Override void put(T object); @Override void close(); }
JdbcDrainDriver implements DrainDriver<T> { @Override public void prepare() throws IOException { LOG.debug("Preparing JDBC resource drain (resource={}, table={})", profile.getResourceName(), script.getTableName()); try { if (truncateOnPrepare) { truncate(); } } catch (SQLException e) { sawError = true; for (SQLException ex = e; ex != null; ex = ex.getNextException()) { WGLOG.error(ex, "E04001", profile.getResourceName(), script.getName(), script.getTableName()); } throw new IOException(MessageFormat.format( "Failed to prepare JDBC drain (resource={0}, table={1}, columns={2})", profile.getResourceName(), script.getTableName(), script.getColumnNames()), e); } try { this.statement = prepareStatement(); } catch (SQLException e) { sawError = true; for (SQLException ex = e; ex != null; ex = ex.getNextException()) { WGLOG.error(ex, "E04002", profile.getResourceName(), script.getName(), script.getTableName(), script.getColumnNames()); } throw new IOException(MessageFormat.format( "Failed to prepare JDBC drain (resource={0}, table={1}, columns={2})", profile.getResourceName(), script.getTableName(), script.getColumnNames()), e); } LOG.debug("Creating PreparedStatement support {} for {}", script.getSupport().getClass().getName(), script.getColumnNames()); support = script.getSupport().createPreparedStatementSupport(statement, script.getColumnNames()); putLimitRest = batchPutUnit; } JdbcDrainDriver(
            JdbcProfile profile,
            JdbcScript<T> script,
            Connection connection,
            boolean truncateOnPrepare); @Override void prepare(); @Override void put(T object); @Override void close();  }