@Test public void testCallableStatementReturningResultSets() { Database db = DatabaseCreator.createDerbyWithStoredProcs(1); db.apply(con -> { try (Statement stmt = con.createStatement()) { CallableStatement st = con.prepareCall("call in1out0rs2(?)"); st.setInt(1, 0); st.execute(); ResultSet rs1 = st.getResultSet(); st.getMoreResults(Statement.KEEP_CURRENT_RESULT); ResultSet rs2 = st.getResultSet(); rs1.next(); assertEquals("FRED", rs1.getString(1)); rs2.next(); assertEquals("SARAH", rs2.getString(1)); } }).blockingAwait(TIMEOUT_SECONDS, TimeUnit.SECONDS); }
public <T> Single<T> apply(Function<? super Connection, ? extends T> function) { return member().map(member -> { try { return function.apply(member.value()); } finally { member.checkin(); } }); }
Database implements AutoCloseable { public <T> Single<T> apply(Function<? super Connection, ? extends T> function) { return member().map(member -> { try { return function.apply(member.value()); } finally { member.checkin(); } }); } }
Database implements AutoCloseable { public <T> Single<T> apply(Function<? super Connection, ? extends T> function) { return member().map(member -> { try { return function.apply(member.value()); } finally { member.checkin(); } }); } private  Database(@Nonnull Pool<Connection> pool, @Nonnull Action onClose); }
Database implements AutoCloseable { public <T> Single<T> apply(Function<? super Connection, ? extends T> function) { return member().map(member -> { try { return function.apply(member.value()); } finally { member.checkin(); } }); } private  Database(@Nonnull Pool<Connection> pool, @Nonnull Action onClose); static NonBlockingConnectionPool.Builder<Database> nonBlocking(); static Database from(@Nonnull String url, int maxPoolSize); static Database from(@Nonnull Pool<Connection> pool); static Database from(@Nonnull Pool<Connection> pool, Action closeAction); static Database fromBlocking(@Nonnull ConnectionProvider cp); static Database fromBlocking(@Nonnull DataSource dataSource); static Database test(int maxPoolSize); static Database test(); Single<Connection> connection(); Flowable<Connection> connections(); @Override void close(); CallableBuilder call(@Nonnull String sql); SelectAutomappedBuilder<T> select(@Nonnull Class<T> cls); SelectBuilder select(@Nonnull String sql); UpdateBuilder update(@Nonnull String sql); TransactedBuilder tx(@Nonnull Tx<?> tx); static Object toSentinelIfNull(@Nullable String s); static Object toSentinelIfNull(@Nullable byte[] bytes); static Object clob(@Nullable String s); static Object blob(@Nullable byte[] bytes); Single<Member<Connection>> member(); Single<T> apply(Function<? super Connection, ? extends T> function); Completable apply(Consumer<? super Connection> consumer); }
Database implements AutoCloseable { public <T> Single<T> apply(Function<? super Connection, ? extends T> function) { return member().map(member -> { try { return function.apply(member.value()); } finally { member.checkin(); } }); } private  Database(@Nonnull Pool<Connection> pool, @Nonnull Action onClose); static NonBlockingConnectionPool.Builder<Database> nonBlocking(); static Database from(@Nonnull String url, int maxPoolSize); static Database from(@Nonnull Pool<Connection> pool); static Database from(@Nonnull Pool<Connection> pool, Action closeAction); static Database fromBlocking(@Nonnull ConnectionProvider cp); static Database fromBlocking(@Nonnull DataSource dataSource); static Database test(int maxPoolSize); static Database test(); Single<Connection> connection(); Flowable<Connection> connections(); @Override void close(); CallableBuilder call(@Nonnull String sql); SelectAutomappedBuilder<T> select(@Nonnull Class<T> cls); SelectBuilder select(@Nonnull String sql); UpdateBuilder update(@Nonnull String sql); TransactedBuilder tx(@Nonnull Tx<?> tx); static Object toSentinelIfNull(@Nullable String s); static Object toSentinelIfNull(@Nullable byte[] bytes); static Object clob(@Nullable String s); static Object blob(@Nullable byte[] bytes); Single<Member<Connection>> member(); Single<T> apply(Function<? super Connection, ? extends T> function); Completable apply(Consumer<? super Connection> consumer); static final Object NULL_CLOB; static final Object NULL_NUMBER; static final Object NULL_BLOB; }