|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcom.xiaoleilu.hutool.db.SqlExecutor
com.xiaoleilu.hutool.db.SqlConnRunner
public class SqlConnRunner
SQL执行类
此执行类只接受方言参数,不需要数据源,只有在执行方法时需要数据库连接对象
此对象存在的意义在于,可以由使用者自定义数据库连接对象,并执行多个方法,方便事务的统一控制或减少连接对象的创建关闭
| 构造方法摘要 | |
|---|---|
SqlConnRunner(Dialect dialect)
构造 |
|
SqlConnRunner(String driverClassName)
构造 |
|
| 方法摘要 | ||
|---|---|---|
int |
count(Connection conn,
Entity where)
结果的条目数 |
|
int |
del(Connection conn,
Entity where)
删除数据 此方法不会关闭Connection |
|
|
find(Connection conn,
Collection<String> fields,
Entity where,
RsHandler<T> rsh)
查询 此方法不会关闭Connection |
|
Long |
insert(Connection conn,
Entity record)
插入数据 此方法不会关闭Connection |
|
|
page(Connection conn,
Collection<String> fields,
Entity where,
int page,
int numPerPage,
RsHandler<T> rsh)
分页查询 此方法不会关闭Connection |
|
int |
update(Connection conn,
Entity record,
Entity where)
更新数据 此方法不会关闭Connection |
|
| 从类 com.xiaoleilu.hutool.db.SqlExecutor 继承的方法 |
|---|
execute, executeBatch, executeForGeneratedKey, query |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public SqlConnRunner(Dialect dialect)
dialect - 方言public SqlConnRunner(String driverClassName)
driverClassName - 驱动类名,,用于识别方言| 方法详细信息 |
|---|
public Long insert(Connection conn,
Entity record)
throws SQLException
conn - 数据库连接record - 记录
SQLException
public int del(Connection conn,
Entity where)
throws SQLException
conn - 数据库连接where - 条件
SQLException
public int update(Connection conn,
Entity record,
Entity where)
throws SQLException
conn - 数据库连接record - 记录
SQLException
public <T> T find(Connection conn,
Collection<String> fields,
Entity where,
RsHandler<T> rsh)
throws SQLException
conn - 数据库连接对象fields - 返回的字段列表,null则返回所有字段where - 条件实体类(包含表名)rsh - 结果集处理对象
SQLException
public <T> T page(Connection conn,
Collection<String> fields,
Entity where,
int page,
int numPerPage,
RsHandler<T> rsh)
throws SQLException
conn - 数据库连接对象fields - 返回的字段列表,null则返回所有字段where - 条件实体类(包含表名)page - 页码numPerPage - 每页条目数rsh - 结果集处理对象
SQLException
public int count(Connection conn,
Entity where)
throws SQLException
conn - 数据库连接对象where - 查询条件
SQLException
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||