mirror of
https://github.com/CarmJos/EasySQL.git
synced 2026-06-04 15:28:20 +08:00
[v0.2.2] 版本优化
- `[F]` 修复部分类的使用异常问题 - `[F]` 修复 SQLUpdateBatchAction 中 getSQLContent 方法返回内容不正确导致的其他方法一并出现异常的问题。 - `[U]` 修改 SQLUpdateBatchAction 的默认异常处理器。 - `[F]` 修复 PreparedSQLBatchUpdateActionImpl 异常继承导致的无法使用的问题。
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>easysql-parent</artifactId>
|
||||
<version>0.2.1</version>
|
||||
<version>0.2.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -138,6 +138,7 @@ public interface SQLAction<T> {
|
||||
return (exception, action) -> {
|
||||
getManager().getLogger().severe("Error when execute [" + action.getSQLContent() + "]");
|
||||
getManager().getLogger().severe(exception.getLocalizedMessage());
|
||||
exception.printStackTrace();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@ package cc.carm.lib.easysql.api.action;
|
||||
|
||||
import cc.carm.lib.easysql.api.SQLAction;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
public interface SQLUpdateAction extends SQLAction<Integer> {
|
||||
|
||||
/**
|
||||
@@ -23,4 +27,6 @@ public interface SQLUpdateAction extends SQLAction<Integer> {
|
||||
return setKeyIndex(-1); // will return changed lines number
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ package cc.carm.lib.easysql.api.action;
|
||||
import cc.carm.lib.easysql.api.SQLAction;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
public interface SQLUpdateBatchAction extends SQLAction<List<Integer>> {
|
||||
|
||||
@@ -15,4 +17,20 @@ public interface SQLUpdateBatchAction extends SQLAction<List<Integer>> {
|
||||
*/
|
||||
SQLUpdateBatchAction addBatch(@NotNull String sql);
|
||||
|
||||
List<String> getSQLContents();
|
||||
|
||||
@Override
|
||||
default BiConsumer<SQLException, SQLAction<List<Integer>>> defaultExceptionHandler() {
|
||||
return (exception, action) -> {
|
||||
getManager().getLogger().severe("Error when execute SQLs : ");
|
||||
int i = 1;
|
||||
for (String content : getSQLContents()) {
|
||||
getManager().getLogger().severe("#" + i + " [" + content + "]");
|
||||
i++;
|
||||
}
|
||||
getManager().getLogger().severe(exception.getLocalizedMessage());
|
||||
exception.printStackTrace();
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public interface ConditionalBuilder<T> extends SQLBuilder {
|
||||
ConditionalBuilder<T> addCondition(@NotNull String[] queryNames, @Nullable Object[] queryValues);
|
||||
|
||||
ConditionalBuilder<T> addNotNullCondition(@NotNull String queryName);
|
||||
|
||||
|
||||
default ConditionalBuilder<T> addTimeCondition(@NotNull String queryName, long startMillis, long endMillis) {
|
||||
return addTimeCondition(queryName,
|
||||
startMillis > 0 ? new Date(startMillis) : null,
|
||||
|
||||
@@ -7,8 +7,6 @@ public interface InsertBuilder<T> {
|
||||
|
||||
String getTableName();
|
||||
|
||||
InsertBuilder<T> setTableName(String tableName);
|
||||
|
||||
T setColumnNames(List<String> columnNames);
|
||||
|
||||
default T setColumnNames(String... columnNames) {
|
||||
|
||||
@@ -7,8 +7,6 @@ public interface ReplaceBuilder<T> {
|
||||
|
||||
String getTableName();
|
||||
|
||||
ReplaceBuilder<T> setTableName(String tableName);
|
||||
|
||||
T setColumnNames(List<String> columnNames);
|
||||
|
||||
default T setColumnNames(String... columnNames) {
|
||||
|
||||
@@ -8,8 +8,6 @@ public interface TableCreateBuilder extends SQLBuilder {
|
||||
|
||||
@NotNull String getTableName();
|
||||
|
||||
TableCreateBuilder setTableName(@NotNull String tableName);
|
||||
|
||||
@NotNull String getTableSettings();
|
||||
|
||||
TableCreateBuilder setTableSettings(@NotNull String settings);
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
package cc.carm.lib.easysql.api.builder;
|
||||
|
||||
public interface UpsertBuilder {
|
||||
|
||||
String getTableName();
|
||||
|
||||
UpsertBuilder setColumnNames(String[] columnNames, String updateColumn);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user