mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add methods
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
* 【core 】 lock放在try外边(pr#1050@Github)
|
* 【core 】 lock放在try外边(pr#1050@Github)
|
||||||
* 【core 】 MailUtil增加错误信息(issue#I1TAKJ@Gitee)
|
* 【core 】 MailUtil增加错误信息(issue#I1TAKJ@Gitee)
|
||||||
* 【core 】 JschUtil添加远程转发功能(pr#171@Gitee)
|
* 【core 】 JschUtil添加远程转发功能(pr#171@Gitee)
|
||||||
|
* 【db 】 AbstractDb增加executeBatch重载(issue#1053@Github)
|
||||||
|
|
||||||
### Bug修复#
|
### Bug修复#
|
||||||
* 【core 】 重新整理农历节假日,解决一个pr过来的玩笑导致的问题
|
* 【core 】 重新整理农历节假日,解决一个pr过来的玩笑导致的问题
|
||||||
|
@@ -248,6 +248,25 @@ public abstract class AbstractDb implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量执行非查询语句
|
||||||
|
*
|
||||||
|
* @param sql SQL
|
||||||
|
* @param paramsBatch 批量的参数
|
||||||
|
* @return 每个SQL执行影响的行数
|
||||||
|
* @throws SQLException SQL执行异常
|
||||||
|
* @since 5.4.2
|
||||||
|
*/
|
||||||
|
public int[] executeBatch(String sql, Iterable<Object[]> paramsBatch) throws SQLException {
|
||||||
|
Connection conn = null;
|
||||||
|
try {
|
||||||
|
conn = this.getConnection();
|
||||||
|
return SqlExecutor.executeBatch(conn, sql, paramsBatch);
|
||||||
|
} finally {
|
||||||
|
this.closeConnection(conn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量执行非查询语句
|
* 批量执行非查询语句
|
||||||
*
|
*
|
||||||
@@ -266,6 +285,24 @@ public abstract class AbstractDb implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量执行非查询语句
|
||||||
|
*
|
||||||
|
* @param sqls SQL列表
|
||||||
|
* @return 每个SQL执行影响的行数
|
||||||
|
* @throws SQLException SQL执行异常
|
||||||
|
* @since 5.4.2
|
||||||
|
*/
|
||||||
|
public int[] executeBatch(Iterable<String> sqls) throws SQLException {
|
||||||
|
Connection conn = null;
|
||||||
|
try {
|
||||||
|
conn = this.getConnection();
|
||||||
|
return SqlExecutor.executeBatch(conn, sqls);
|
||||||
|
} finally {
|
||||||
|
this.closeConnection(conn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------- CRUD start
|
// ---------------------------------------------------------------------------- CRUD start
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user