Package guru.mikelue.jdut.jdbc.function
Class DbResultSet
- java.lang.Object
-
- guru.mikelue.jdut.jdbc.function.DbResultSet
-
public final class DbResultSet extends Object
Utility used to buildJdbcRunnable
orJdbcSupplier
for processing aResultSet
with some primitive values(e.g., SQL string).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JdbcRunnable
buildRunnable(Connection conn, String sql, JdbcVoidFunction<? super ResultSet> executor)
Builds runnable by connection and SQL string.
This method would useStatement.executeQuery(java.lang.String)
for getting result set.static JdbcRunnable
buildRunnable(Statement statement, String sql, JdbcVoidFunction<? super ResultSet> executor)
Builds runnable byStatement
and SQL string.
This method would useStatement.executeQuery(java.lang.String)
for getting result set.static <T> JdbcSupplier<T>
buildSupplier(Connection conn, String sql, JdbcFunction<? super ResultSet,? extends T> supplier)
Builds supplier by connection and SQL string.
This method would useStatement.executeQuery(java.lang.String)
for getting result set.static <T> JdbcSupplier<T>
buildSupplier(Statement statement, String sql, JdbcFunction<? super ResultSet,? extends T> supplier)
Builds supplier byStatement
and SQL string.
This method would useStatement.executeQuery(java.lang.String)
for getting result set.
-
-
-
Method Detail
-
buildRunnable
public static JdbcRunnable buildRunnable(Connection conn, String sql, JdbcVoidFunction<? super ResultSet> executor)
Builds runnable by connection and SQL string.
This method would useStatement.executeQuery(java.lang.String)
for getting result set.- Parameters:
conn
- The connection of database(won't be closed in the lambda)sql
- The SQL to query dataexecutor
- The executor of result set from query- Returns:
- The instance of lambda
-
buildRunnable
public static JdbcRunnable buildRunnable(Statement statement, String sql, JdbcVoidFunction<? super ResultSet> executor)
Builds runnable byStatement
and SQL string.
This method would useStatement.executeQuery(java.lang.String)
for getting result set.- Parameters:
statement
- The statement to be used(won't be closed in the lambda)sql
- The SQL to query dataexecutor
- The executor of accepting set from query- Returns:
- The instance of lambda
-
buildSupplier
public static <T> JdbcSupplier<T> buildSupplier(Connection conn, String sql, JdbcFunction<? super ResultSet,? extends T> supplier)
Builds supplier by connection and SQL string.
This method would useStatement.executeQuery(java.lang.String)
for getting result set.- Type Parameters:
T
- The type of returned value- Parameters:
conn
- The connection of database(won't be closed in the lambda)sql
- The SQL to query datasupplier
- The supplier accepting result set from query- Returns:
- The instance of lambda
-
buildSupplier
public static <T> JdbcSupplier<T> buildSupplier(Statement statement, String sql, JdbcFunction<? super ResultSet,? extends T> supplier)
Builds supplier byStatement
and SQL string.
This method would useStatement.executeQuery(java.lang.String)
for getting result set.- Type Parameters:
T
- The type of returned value- Parameters:
statement
- The statement to be used(won't be closed in the lambda)sql
- The SQL to query datasupplier
- The supplier accepting result set from query- Returns:
- The instance of lambda
-
-