public abstract class JdbcUtils extends Object
| 限定符和类型 | 类和说明 |
|---|---|
(专用程序包) static class |
JdbcUtils.CursorImpl
CursorImpl
|
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
DDL_TRUNCATE_TABLE |
static String |
SQL_ROW_COUNT |
| 构造器和说明 |
|---|
JdbcUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
batchScan(ConnectionFactory connectionFactory,
PageableSql pageableSql,
Object[] args,
int page,
int pageSize,
java.util.function.Consumer<List<Tuple>> consumer,
long maxRecords) |
static void |
batchScan(ConnectionFactory connectionFactory,
PageableSql pageableSql,
PreparedStatementCallback callback,
int page,
int pageSize,
java.util.function.Consumer<List<Tuple>> consumer,
long maxRecords) |
static void |
batchScan(ConnectionFactory connectionFactory,
String sql,
Object[] args,
int page,
int pageSize,
java.util.function.Consumer<List<Tuple>> consumer,
long maxRecords) |
static void |
batchScan(ConnectionFactory connectionFactory,
String sql,
PreparedStatementCallback callback,
int page,
int pageSize,
java.util.function.Consumer<List<Tuple>> consumer,
long maxRecords) |
static void |
batchScan(DataSource dataSource,
String sql,
Object[] args,
int page,
int pageSize,
java.util.function.Consumer<List<Tuple>> consumer,
long maxRecords) |
static void |
batchScan(DataSource dataSource,
String sql,
PreparedStatementCallback callback,
int page,
int pageSize,
java.util.function.Consumer<List<Tuple>> consumer,
long maxRecords) |
static int[] |
batchUpdate(Connection connection,
String sql,
List<Object[]> argsList) |
static int[] |
batchUpdate(Connection connection,
String sql,
PreparedStatementCallback callback) |
static void |
close(Connection connection) |
static void |
close(ResultSet rs) |
static void |
close(Statement stmt) |
private static void |
closeLazily(Observable observable,
ResultSet rs,
Statement sm,
Connection connection) |
static void |
closeQuietly(Connection connection) |
static void |
closeQuietly(ResultSet rs) |
static void |
closeQuietly(Statement stmt) |
static void |
commit(Connection connection) |
static void |
commitAndClose(Connection connection) |
static void |
commitAndCloseQuietly(Connection connection) |
static void |
commitQuietly(Connection connection) |
static Cursor<Tuple> |
cursor(Connection connection,
String sql) |
static Cursor<Tuple> |
cursor(Connection connection,
String sql,
Object[] args) |
static Cursor<Tuple> |
cursor(Connection connection,
String sql,
PreparedStatementCallback callback) |
static Cursor<Tuple> |
describe(Connection connection) |
static Cursor<Tuple> |
describe(Connection connection,
String catalog,
String schema) |
static void |
disableCommit(Connection connection) |
static void |
disableCommitQuietly(Connection connection) |
static boolean |
existsTable(Connection connection,
String schema,
String tableName) |
static boolean |
existsTable(Connection connection,
String catalog,
String schema,
String tableName) |
static List<Tuple> |
fetchAll(Connection connection,
String sql) |
static List<Tuple> |
fetchAll(Connection connection,
String sql,
Object[] args) |
static List<Tuple> |
fetchAll(Connection connection,
String sql,
PreparedStatementCallback callback) |
static Tuple |
fetchOne(Connection connection,
String sql) |
static <T> T |
fetchOne(Connection connection,
String sql,
Class<T> requiredType) |
static Tuple |
fetchOne(Connection connection,
String sql,
Object[] args) |
static <T> T |
fetchOne(Connection connection,
String sql,
Object[] args,
Class<T> requiredType) |
static Tuple |
fetchOne(Connection connection,
String sql,
PreparedStatementCallback callback) |
static <T> T |
fetchOne(Connection connection,
String sql,
PreparedStatementCallback callback,
Class<T> requiredType) |
static Connection |
getConnection(String url,
String user,
String password) |
static Cursor<Tuple> |
getFkMetadata(Connection connection,
String tableName) |
static Cursor<Tuple> |
getFkMetadata(Connection connection,
String catalog,
String schema,
String tableName) |
static Cursor<Tuple> |
getPkMetadata(Connection connection,
String tableName) |
static Cursor<Tuple> |
getPkMetadata(Connection connection,
String catalog,
String schema,
String tableName) |
static Cursor<Tuple> |
getTableMetadata(Connection connection,
String tableName) |
static Cursor<Tuple> |
getTableMetadata(Connection connection,
String catalog,
String schema,
String tableName) |
static int |
insert(Connection connection,
String sql,
Object[] args) |
static int |
insert(Connection connection,
String sql,
PreparedStatementCallback callback) |
static PageableQuery<Tuple> |
pageableQuery(ConnectionFactory connectionFactory,
PageableSql pageableSql,
Object[] args) |
static PageableQuery<Tuple> |
pageableQuery(ConnectionFactory connectionFactory,
PageableSql pageableSql,
PreparedStatementCallback callback) |
static PageableQuery<Tuple> |
pageableQuery(ConnectionFactory connectionFactory,
String sql,
Object[] args) |
static PageableQuery<Tuple> |
pageableQuery(ConnectionFactory connectionFactory,
String sql,
PreparedStatementCallback callback) |
static PageableQuery<Tuple> |
pageableQuery(DataSource dataSource,
PageableSql pageableSql,
Object[] args) |
static PageableQuery<Tuple> |
pageableQuery(DataSource dataSource,
PageableSql pageableSql,
PreparedStatementCallback callback) |
static PageableQuery<Tuple> |
pageableQuery(DataSource dataSource,
String sql,
Object[] args) |
static PageableQuery<Tuple> |
pageableQuery(DataSource dataSource,
String sql,
PreparedStatementCallback callback) |
static void |
printStackTrace(SQLException e) |
static void |
printStackTrace(SQLException e,
PrintWriter pw) |
static void |
printWarnings(Connection connection) |
static void |
printWarnings(Connection connection,
PrintWriter pw) |
static void |
rollback(Connection connection) |
static void |
rollbackAndClose(Connection connection) |
static void |
rollbackAndCloseQuietly(Connection connection) |
static void |
rollbackQuietly(Connection connection) |
static long |
rowCount(Connection connection,
String sql) |
static long |
rowCount(Connection connection,
String sql,
Object[] args) |
static long |
rowCount(Connection connection,
String sql,
PreparedStatementCallback callback) |
static void |
scan(Connection connection,
String sql,
Object[] args,
java.util.function.Consumer<Tuple> consumer,
long maxRecords) |
static void |
scan(Connection connection,
String sql,
PreparedStatementCallback callback,
java.util.function.Consumer<Tuple> consumer,
long maxRecords) |
static void |
setPath(Connection connection,
String catalog,
String schema) |
private static PreparedStatementCallback |
setValues(List<Object[]> argsList) |
private static PreparedStatementCallback |
setValues(Object[] args) |
static void |
setValues(PreparedStatement ps,
Object[] args) |
static Tuple |
toTuple(ResultSet rs) |
static Tuple |
toTuple(ResultSet rs,
CaseFormat caseFormat) |
static void |
truncateTable(Connection connection,
String tableName) |
static int |
update(Connection connection,
String sql) |
static int |
update(Connection connection,
String sql,
Object[] args) |
static int |
update(Connection connection,
String sql,
PreparedStatementCallback callback) |
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 setPath(Connection connection, String catalog, String schema) throws SQLException
SQLExceptionpublic static void disableCommit(Connection connection) throws SQLException
SQLExceptionpublic static void disableCommitQuietly(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)
public static Tuple toTuple(ResultSet rs) throws SQLException
SQLExceptionpublic static Tuple toTuple(ResultSet rs, CaseFormat caseFormat) throws SQLException
SQLExceptionpublic static void scan(Connection connection, String sql, Object[] args, java.util.function.Consumer<Tuple> consumer, long maxRecords) throws SQLException
SQLExceptionpublic static void scan(Connection connection, String sql, PreparedStatementCallback callback, java.util.function.Consumer<Tuple> consumer, long maxRecords) throws SQLException
SQLExceptionpublic static void batchScan(DataSource dataSource, String sql, Object[] args, int page, int pageSize, java.util.function.Consumer<List<Tuple>> consumer, long maxRecords) throws SQLException
SQLExceptionpublic static void batchScan(DataSource dataSource, String sql, PreparedStatementCallback callback, int page, int pageSize, java.util.function.Consumer<List<Tuple>> consumer, long maxRecords) throws SQLException
SQLExceptionpublic static void batchScan(ConnectionFactory connectionFactory, String sql, Object[] args, int page, int pageSize, java.util.function.Consumer<List<Tuple>> consumer, long maxRecords) throws SQLException
SQLExceptionpublic static void batchScan(ConnectionFactory connectionFactory, PageableSql pageableSql, Object[] args, int page, int pageSize, java.util.function.Consumer<List<Tuple>> consumer, long maxRecords) throws SQLException
SQLExceptionpublic static void batchScan(ConnectionFactory connectionFactory, String sql, PreparedStatementCallback callback, int page, int pageSize, java.util.function.Consumer<List<Tuple>> consumer, long maxRecords) throws SQLException
SQLExceptionpublic static void batchScan(ConnectionFactory connectionFactory, PageableSql pageableSql, PreparedStatementCallback callback, int page, int pageSize, java.util.function.Consumer<List<Tuple>> consumer, long maxRecords) 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 long rowCount(Connection connection, String sql) throws SQLException
SQLExceptionpublic static long rowCount(Connection connection, String sql, Object[] args) throws SQLException
SQLExceptionpublic static long rowCount(Connection connection, String sql, PreparedStatementCallback callback) throws SQLException
SQLExceptionpublic static void truncateTable(Connection connection, String tableName) throws SQLException
SQLExceptionpublic static boolean existsTable(Connection connection, String schema, String tableName) throws SQLException
SQLExceptionpublic static boolean existsTable(Connection connection, String catalog, String schema, String tableName) throws SQLException
SQLExceptionpublic static Cursor<Tuple> describe(Connection connection) throws SQLException
SQLExceptionpublic static Cursor<Tuple> describe(Connection connection, String catalog, String schema) throws SQLException
SQLExceptionpublic static Cursor<Tuple> getTableMetadata(Connection connection, String tableName) throws SQLException
SQLExceptionpublic static Cursor<Tuple> getTableMetadata(Connection connection, String catalog, String schema, String tableName) throws SQLException
SQLExceptionpublic static Cursor<Tuple> getPkMetadata(Connection connection, String tableName) throws SQLException
SQLExceptionpublic static Cursor<Tuple> getPkMetadata(Connection connection, String catalog, String schema, String tableName) throws SQLException
SQLExceptionpublic static Cursor<Tuple> getFkMetadata(Connection connection, String tableName) throws SQLException
SQLExceptionpublic static Cursor<Tuple> getFkMetadata(Connection connection, String catalog, String schema, String tableName) throws SQLException
SQLExceptionCopyright © 2022. All rights reserved.