@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 (JdbcSourceDriver<Pair> driver = new JdbcSourceDriver<>(profile(), script, conn, new Pair())) { driver.prepare(); List<String> values = values(driver); assertThat(values, is(Collections.emptyList())); } } }
@Override public void prepare() throws IOException { LOG.debug("Preparing JDBC resource source (resource={}, table={})", profile.getResourceName(), script.getTableName()); try { this.resultSet = prepareResultSet(); } catch (SQLException e) { for (SQLException ex = e; ex != null; ex = ex.getNextException()) { WGLOG.error(ex, "E03001", profile.getResourceName(), script.getName(), script.getTableName(), script.getColumnNames()); } throw new IOException(MessageFormat.format( "Failed to prepare JDBC source (resource={0}, table={1}, columns={2})", profile.getResourceName(), script.getTableName(), script.getColumnNames()), e); } LOG.debug("Creating ResultSet support {} for {}", script.getSupport().getClass().getName(), script.getColumnNames()); support = script.getSupport().createResultSetSupport(resultSet, script.getColumnNames()); }
JdbcSourceDriver implements SourceDriver<T> { @Override public void prepare() throws IOException { LOG.debug("Preparing JDBC resource source (resource={}, table={})", profile.getResourceName(), script.getTableName()); try { this.resultSet = prepareResultSet(); } catch (SQLException e) { for (SQLException ex = e; ex != null; ex = ex.getNextException()) { WGLOG.error(ex, "E03001", profile.getResourceName(), script.getName(), script.getTableName(), script.getColumnNames()); } throw new IOException(MessageFormat.format( "Failed to prepare JDBC source (resource={0}, table={1}, columns={2})", profile.getResourceName(), script.getTableName(), script.getColumnNames()), e); } LOG.debug("Creating ResultSet support {} for {}", script.getSupport().getClass().getName(), script.getColumnNames()); support = script.getSupport().createResultSetSupport(resultSet, script.getColumnNames()); } }
JdbcSourceDriver implements SourceDriver<T> { @Override public void prepare() throws IOException { LOG.debug("Preparing JDBC resource source (resource={}, table={})", profile.getResourceName(), script.getTableName()); try { this.resultSet = prepareResultSet(); } catch (SQLException e) { for (SQLException ex = e; ex != null; ex = ex.getNextException()) { WGLOG.error(ex, "E03001", profile.getResourceName(), script.getName(), script.getTableName(), script.getColumnNames()); } throw new IOException(MessageFormat.format( "Failed to prepare JDBC source (resource={0}, table={1}, columns={2})", profile.getResourceName(), script.getTableName(), script.getColumnNames()), e); } LOG.debug("Creating ResultSet support {} for {}", script.getSupport().getClass().getName(), script.getColumnNames()); support = script.getSupport().createResultSetSupport(resultSet, script.getColumnNames()); } JdbcSourceDriver(
            JdbcProfile profile,
            JdbcScript<T> script,
            Connection connection,
            T object); }
JdbcSourceDriver implements SourceDriver<T> { @Override public void prepare() throws IOException { LOG.debug("Preparing JDBC resource source (resource={}, table={})", profile.getResourceName(), script.getTableName()); try { this.resultSet = prepareResultSet(); } catch (SQLException e) { for (SQLException ex = e; ex != null; ex = ex.getNextException()) { WGLOG.error(ex, "E03001", profile.getResourceName(), script.getName(), script.getTableName(), script.getColumnNames()); } throw new IOException(MessageFormat.format( "Failed to prepare JDBC source (resource={0}, table={1}, columns={2})", profile.getResourceName(), script.getTableName(), script.getColumnNames()), e); } LOG.debug("Creating ResultSet support {} for {}", script.getSupport().getClass().getName(), script.getColumnNames()); support = script.getSupport().createResultSetSupport(resultSet, script.getColumnNames()); } JdbcSourceDriver(
            JdbcProfile profile,
            JdbcScript<T> script,
            Connection connection,
            T object); @Override void prepare(); @Override boolean next(); @Override T get(); @Override void close(); }
JdbcSourceDriver implements SourceDriver<T> { @Override public void prepare() throws IOException { LOG.debug("Preparing JDBC resource source (resource={}, table={})", profile.getResourceName(), script.getTableName()); try { this.resultSet = prepareResultSet(); } catch (SQLException e) { for (SQLException ex = e; ex != null; ex = ex.getNextException()) { WGLOG.error(ex, "E03001", profile.getResourceName(), script.getName(), script.getTableName(), script.getColumnNames()); } throw new IOException(MessageFormat.format( "Failed to prepare JDBC source (resource={0}, table={1}, columns={2})", profile.getResourceName(), script.getTableName(), script.getColumnNames()), e); } LOG.debug("Creating ResultSet support {} for {}", script.getSupport().getClass().getName(), script.getColumnNames()); support = script.getSupport().createResultSetSupport(resultSet, script.getColumnNames()); } JdbcSourceDriver(
            JdbcProfile profile,
            JdbcScript<T> script,
            Connection connection,
            T object); @Override void prepare(); @Override boolean next(); @Override T get(); @Override void close();  }