mirror of
https://github.com/CarmJos/EasySQL.git
synced 2026-06-04 15:28:20 +08:00
[0.3.9] 版本更新
- `[R]` 修改项目结构,移除无用的 `easysql-tester` 模块, 整合相关测试到 `easysql-demo` 的`src/test` 下。 - `[U]` 移除`DefaultSQLExceptionHandler` 类,与 `SQLExceptionHandler` 接口下添加 `detailed()` 与 `silent()` 两种预设错误处理器,并支持通过 `SQLManager#setExceptionHandler()` 方法应用全局生效的默认错误处理器。 > 注意: 十分不建议使用 `silent()` 处理器为默认处理器!
This commit is contained in:
+3
-3
@@ -5,13 +5,13 @@
|
||||
<parent>
|
||||
<artifactId>easysql-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>0.3.8</version>
|
||||
<version>0.3.9</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
||||
</properties>
|
||||
|
||||
@@ -10,6 +10,7 @@ import cc.carm.lib.easysql.api.action.PreparedSQLUpdateAction;
|
||||
import cc.carm.lib.easysql.api.action.PreparedSQLUpdateBatchAction;
|
||||
import cc.carm.lib.easysql.api.action.SQLUpdateBatchAction;
|
||||
import cc.carm.lib.easysql.api.builder.*;
|
||||
import cc.carm.lib.easysql.api.function.SQLExceptionHandler;
|
||||
import cc.carm.lib.easysql.builder.impl.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -32,6 +33,8 @@ public class SQLManagerImpl implements SQLManager {
|
||||
protected ExecutorService executorPool;
|
||||
@NotNull Supplier<Boolean> debugMode = () -> Boolean.FALSE;
|
||||
|
||||
@NotNull SQLExceptionHandler exceptionHandler;
|
||||
|
||||
public SQLManagerImpl(@NotNull DataSource dataSource) {
|
||||
this(dataSource, null);
|
||||
}
|
||||
@@ -45,6 +48,8 @@ public class SQLManagerImpl implements SQLManager {
|
||||
thread.setDaemon(true);
|
||||
return thread;
|
||||
});
|
||||
|
||||
this.exceptionHandler = SQLExceptionHandler.detailed(getLogger());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,6 +90,17 @@ public class SQLManagerImpl implements SQLManager {
|
||||
return this.activeQuery;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull SQLExceptionHandler getExceptionHandler() {
|
||||
return this.exceptionHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExceptionHandler(@Nullable SQLExceptionHandler handler) {
|
||||
if (handler == null) this.exceptionHandler = SQLExceptionHandler.detailed(getLogger());
|
||||
else this.exceptionHandler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer executeSQL(String sql) {
|
||||
return new SQLUpdateActionImpl(this, sql).execute(null);
|
||||
|
||||
Reference in New Issue
Block a user