public abstract class JdbcUtils extends Object
| 限定符和类型 | 类和说明 |
|---|---|
private static class |
JdbcUtils.CursorImpl
CursorImpl
|
| 构造器和说明 |
|---|
JdbcUtils() |
public static void close(Connection connection) throws SQLException
SQLExceptionpublic static void close(ResultSet rs) throws SQLException
SQLExceptionpublic static void close(Statement stmt) throws SQLException
SQLExceptionpublic static void closeQuietly(Connection connection)
public static void closeQuietly(ResultSet rs)
public static void closeQuietly(Statement stmt)
public static void commit(Connection connection) throws SQLException
SQLExceptionpublic static void commitQuietly(Connection connection)
public static void commitAndClose(Connection connection) throws SQLException
SQLExceptionpublic static void commitAndCloseQuietly(Connection connection)
public static void rollback(Connection connection) throws SQLException
SQLExceptionpublic static void rollbackQuietly(Connection connection)
public static void rollbackAndClose(Connection connection) throws SQLException
SQLExceptionpublic static void rollbackAndCloseQuietly(Connection connection)
public static void printStackTrace(SQLException e)
public static void printStackTrace(SQLException e, PrintWriter pw)
public static void printWarnings(Connection connection)
public static void printWarnings(Connection connection, PrintWriter pw)
public static Connection getConnection(String url, String user, String password) throws SQLException
SQLExceptionpublic static int update(Connection connection, String sql) throws SQLException
SQLExceptionpublic static int[] batchUpdate(Connection connection, String sql, List<Object[]> argsList) throws SQLException
SQLExceptionpublic static int[] batchUpdate(Connection connection, String sql, PreparedStatementCallback callback) throws SQLException
SQLExceptionpublic static int insert(Connection connection, String sql, Object[] args) throws SQLException
SQLExceptionpublic static int insert(Connection connection, String sql, PreparedStatementCallback callback) throws SQLException
SQLExceptionpublic static int update(Connection connection, String sql, Object[] args) throws SQLException
SQLExceptionpublic static int update(Connection connection, String sql, PreparedStatementCallback callback) throws SQLException
SQLExceptionpublic static <T> T fetchOne(Connection connection, String sql, Class<T> requiredType) throws SQLException
SQLExceptionpublic static Tuple fetchOne(Connection connection, String sql) throws SQLException
SQLExceptionpublic static List<Tuple> fetchAll(Connection connection, String sql) throws SQLException
SQLExceptionpublic static Cursor<Tuple> cursor(Connection connection, String sql) throws SQLException
SQLExceptionpublic static <T> T fetchOne(Connection connection, String sql, Object[] args, Class<T> requiredType) throws SQLException
SQLExceptionpublic static <T> T fetchOne(Connection connection, String sql, PreparedStatementCallback callback, Class<T> requiredType) throws SQLException
SQLExceptionpublic static Tuple fetchOne(Connection connection, String sql, Object[] args) throws SQLException
SQLExceptionpublic static Tuple fetchOne(Connection connection, String sql, PreparedStatementCallback callback) throws SQLException
SQLExceptionpublic static List<Tuple> fetchAll(Connection connection, String sql, Object[] args) throws SQLException
SQLExceptionpublic static List<Tuple> fetchAll(Connection connection, String sql, PreparedStatementCallback callback) throws SQLException
SQLExceptionpublic static Cursor<Tuple> cursor(Connection connection, String sql, Object[] args) throws SQLException
SQLExceptionpublic static Cursor<Tuple> cursor(Connection connection, String sql, PreparedStatementCallback callback) throws SQLException
SQLExceptionprivate static void closeLazily(Observable observable, ResultSet rs, Statement sm, Connection connection)
private static Tuple toTuple(ResultSet rs) throws SQLException
SQLExceptionpublic static void scan(Connection connection, String sql, Object[] args, java.util.function.Consumer<Tuple> consumer) throws SQLException
SQLExceptionpublic static void scan(Connection connection, String sql, PreparedStatementCallback callback, java.util.function.Consumer<Tuple> consumer) throws SQLException
SQLExceptionpublic static void scan(ConnectionFactory connectionFactory, PageableSql pageableSql, Object[] args, int page, int pageSize, java.util.function.Consumer<List<Tuple>> consumer) throws SQLException
SQLExceptionpublic static void scan(ConnectionFactory connectionFactory, String sql, PreparedStatementCallback callback, int page, int pageSize, java.util.function.Consumer<List<Tuple>> consumer) throws SQLException
SQLExceptionpublic static void scan(ConnectionFactory connectionFactory, PageableSql pageableSql, PreparedStatementCallback callback, int page, int pageSize, java.util.function.Consumer<List<Tuple>> consumer) throws SQLException
SQLExceptionpublic static PageableQuery<Tuple> pageableQuery(DataSource dataSource, String sql, Object[] args)
public static PageableQuery<Tuple> pageableQuery(DataSource dataSource, String sql, PreparedStatementCallback callback)
public static PageableQuery<Tuple> pageableQuery(DataSource dataSource, PageableSql pageableSql, Object[] args)
public static PageableQuery<Tuple> pageableQuery(DataSource dataSource, PageableSql pageableSql, PreparedStatementCallback callback)
public static PageableQuery<Tuple> pageableQuery(ConnectionFactory connectionFactory, String sql, Object[] args)
public static PageableQuery<Tuple> pageableQuery(ConnectionFactory connectionFactory, String sql, PreparedStatementCallback callback)
public static PageableQuery<Tuple> pageableQuery(ConnectionFactory connectionFactory, PageableSql pageableSql, Object[] args)
public static PageableQuery<Tuple> pageableQuery(ConnectionFactory connectionFactory, PageableSql pageableSql, PreparedStatementCallback callback)
public static void setValues(PreparedStatement ps, Object[] args) throws SQLException
SQLExceptionprivate static PreparedStatementCallback setValues(List<Object[]> argsList)
private static PreparedStatementCallback setValues(Object[] args)
public static boolean existsTable(DatabaseMetaData dbmd, String schema, String tableName) throws SQLException
SQLExceptionpublic static boolean existsTable(Connection connection, String schema, String tableName) throws SQLException
SQLExceptionCopyright © 2020. All rights reserved.