mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add null check
This commit is contained in:
parent
a81306ef5c
commit
0dd57b9e31
@ -6,6 +6,7 @@
|
||||
# 5.7.15 (2021-10-10)
|
||||
|
||||
### 🐣新特性
|
||||
* 【db 】 Db.quietSetAutoCommit增加判空(issue#I4D75B@Gitee)
|
||||
### 🐞Bug修复
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1,10 +1,5 @@
|
||||
package cn.hutool.db;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import cn.hutool.core.lang.func.VoidFunc1;
|
||||
import cn.hutool.db.dialect.Dialect;
|
||||
import cn.hutool.db.dialect.DialectFactory;
|
||||
@ -13,6 +8,10 @@ import cn.hutool.db.sql.Wrapper;
|
||||
import cn.hutool.db.transaction.TransactionLevel;
|
||||
import cn.hutool.log.StaticLog;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* 数据库操作类<br>
|
||||
* 通过给定的数据源执行给定SQL或者给定数据源和方言,执行相应的CRUD操作<br>
|
||||
@ -228,7 +227,7 @@ public class Db extends AbstractDb {
|
||||
* @param autoCommit 是否自动提交
|
||||
*/
|
||||
private void quietSetAutoCommit(Connection conn, Boolean autoCommit) {
|
||||
if (null != autoCommit) {
|
||||
if (null != conn && null != autoCommit) {
|
||||
try {
|
||||
conn.setAutoCommit(autoCommit);
|
||||
} catch (Exception e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user