public class JdbcUtils extends Object
| 构造器和说明 |
|---|
JdbcUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static FieldType |
buildJdbcFieldType(int type) |
static boolean |
checkTableExists(Connection conn,
String tableName) |
static void |
closeConnection(Connection con)
Close the given JDBC Connection and ignore any thrown exception.
|
static void |
closeResultSet(ResultSet rs)
Close the given JDBC ResultSet and ignore any thrown exception.
|
static void |
closeStatement(Statement stmt)
Close the given JDBC Statement and ignore any thrown exception.
|
static void |
fillPreparedStatementParameters(List<Object> parameters,
PreparedStatement stmt) |
static Connection |
getConnection() |
static String |
getCountSql(String sql)
获取总记录数计算的sql
|
static String |
getOriginSql(String sql) |
static String |
getPageSql(Connection conn,
String sql,
long startRow,
int pageSize) |
static String |
getPageSql(String sql,
long startRow,
int pageSize)
获取分页计算的sql
|
static String |
getPlatform() |
static void |
rollback(Connection conn) |
static void |
rollbackConnection(Connection con) |
static void |
setAutoCommit(Connection conn,
boolean autoCommit) |
public static FieldType buildJdbcFieldType(int type)
public static void fillPreparedStatementParameters(List<Object> parameters, PreparedStatement stmt) throws Exception
Exceptionpublic static void rollback(Connection conn)
public static void setAutoCommit(Connection conn, boolean autoCommit)
public static void closeConnection(Connection con)
con - the JDBC Connection to close (may be null)public static void rollbackConnection(Connection con)
public static void closeStatement(Statement stmt)
stmt - the JDBC Statement to close (may be null)public static void closeResultSet(ResultSet rs)
rs - the JDBC ResultSet to close (may be null)public static boolean checkTableExists(Connection conn, String tableName)
public static Connection getConnection()
public static String getPlatform()
public static String getPageSql(Connection conn, String sql, long startRow, int pageSize)
public static String getPageSql(String sql, long startRow, int pageSize)
sql - 原始sqlstartRow - 起始行pageSize - 分页大小Copyright © 2023 Bstek. All rights reserved.