Skip to content

Commit

Permalink
✨ feature(1.1.14): 新增 StrictRecordSet, 发生错误时不进行抑制
Browse files Browse the repository at this point in the history
  • Loading branch information
ruan4261 committed Jul 16, 2021
1 parent 84047d2 commit caae1e3
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/weaver/micro/devkit/DatabaseRuntimeException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package weaver.micro.devkit;

public class DatabaseRuntimeException extends RuntimeException {

public DatabaseRuntimeException() {
super();
}

public DatabaseRuntimeException(String message) {
super(message);
}

public DatabaseRuntimeException(String message, Throwable cause) {
super(message, cause);
}

public DatabaseRuntimeException(Throwable cause) {
super(cause);
}

}
51 changes: 51 additions & 0 deletions src/main/java/weaver/micro/devkit/handler/StrictRecordSet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package weaver.micro.devkit.handler;

import com.api.integration.util.ProcBean;
import weaver.conn.RecordSet;
import weaver.micro.devkit.DatabaseRuntimeException;

import java.util.List;

public class StrictRecordSet extends RecordSet {

@Override
public boolean executeProc(String s, String s1, String s2) {
return $(super.executeProc(s, s1, s2));
}

@Override
public boolean executeProc2(String s, String s1, String s2) {
return $(super.executeProc2(s, s1, s2));
}

// public boolean executeProcNew(String s, String s1, List<ProcBean> list) {
// return $(super.executeProcNew(s, s1, list));
// }

@Override
public boolean executeSql(String s, boolean b, String s1, boolean b1, Object... objects) {
return $(super.executeSql(s, b, s1, b1, objects));
}

// public boolean executeBatchSql(String s, List<?> list, String s1) {
// return $(super.executeBatchSql(s, list, s1));
// }

@Override
public boolean executeSql(String s, String s1) {
return $(super.executeSql(s, s1));
}

@Override
public boolean executeSqlWithDataSource(String s, String s1) {
return $(super.executeSqlWithDataSource(s, s1));
}

boolean $(boolean result) {
if (!result)
throw new DatabaseRuntimeException(this.getExceptionMsg());

return true;
}

}

1 comment on commit caae1e3

@ruan4261
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#4 该提交的类中使用的方法在 2017 及之前版本中不兼容, 2.0 版本时该类会做出调整.

Please sign in to comment.