public class StatementUtil extends Object
| 构造器和说明 |
|---|
StatementUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static PreparedStatement |
fillParams(PreparedStatement ps,
Collection<Object> params)
填充SQL的参数。
|
static PreparedStatement |
fillParams(PreparedStatement ps,
Object... params)
填充SQL的参数。
|
static Long |
getGeneratedKeyOfLong(PreparedStatement ps)
获得自增键的值
此方法对于Oracle无效 |
static List<Object> |
getGeneratedKeys(PreparedStatement ps)
获得所有主键
|
static CallableStatement |
prepareCall(Connection conn,
String sql,
Object... params)
|
static PreparedStatement |
prepareStatement(Connection conn,
SqlBuilder sqlBuilder)
|
static PreparedStatement |
prepareStatement(Connection conn,
String sql,
Collection<Object> params)
|
static PreparedStatement |
prepareStatement(Connection conn,
String sql,
Object... params)
|
static PreparedStatement |
prepareStatementForBatch(Connection conn,
String sql,
Iterable<Object[]> paramsBatch)
创建批量操作的
PreparedStatement |
static PreparedStatement |
prepareStatementForBatch(Connection conn,
String sql,
Object[]... paramsBatch)
创建批量操作的
PreparedStatement |
public static PreparedStatement fillParams(PreparedStatement ps, Collection<Object> params) throws SQLException
ps - PreparedStatementparams - SQL参数PreparedStatementSQLException - SQL执行异常public static PreparedStatement fillParams(PreparedStatement ps, Object... params) throws SQLException
ps - PreparedStatementparams - SQL参数PreparedStatementSQLException - SQL执行异常public static PreparedStatement prepareStatement(Connection conn, SqlBuilder sqlBuilder) throws SQLException
conn - 数据库连接sqlBuilder - SqlBuilder包括SQL语句和参数PreparedStatementSQLException - SQL异常public static PreparedStatement prepareStatement(Connection conn, String sql, Collection<Object> params) throws SQLException
conn - 数据库连接sql - SQL语句,使用"?"做为占位符params - "?"对应参数列表PreparedStatementSQLException - SQL异常public static PreparedStatement prepareStatement(Connection conn, String sql, Object... params) throws SQLException
conn - 数据库连接sql - SQL语句,使用"?"做为占位符params - "?"对应参数列表PreparedStatementSQLException - SQL异常public static PreparedStatement prepareStatementForBatch(Connection conn, String sql, Object[]... paramsBatch) throws SQLException
PreparedStatementconn - 数据库连接sql - SQL语句,使用"?"做为占位符paramsBatch - "?"对应参数批次列表PreparedStatementSQLException - SQL异常public static PreparedStatement prepareStatementForBatch(Connection conn, String sql, Iterable<Object[]> paramsBatch) throws SQLException
PreparedStatementconn - 数据库连接sql - SQL语句,使用"?"做为占位符paramsBatch - "?"对应参数批次列表PreparedStatementSQLException - SQL异常public static CallableStatement prepareCall(Connection conn, String sql, Object... params) throws SQLException
conn - 数据库连接sql - SQL语句,使用"?"做为占位符params - "?"对应参数列表CallableStatementSQLException - SQL异常public static Long getGeneratedKeyOfLong(PreparedStatement ps) throws SQLException
ps - PreparedStatementSQLException - SQL执行异常public static List<Object> getGeneratedKeys(PreparedStatement ps) throws SQLException
ps - PreparedStatementSQLException - SQL执行异常Copyright © 2019. All rights reserved.