将隐藏字段功能单独抽取方法 isHideColumn,方便重写来自定义

This commit is contained in:
TommyLemon 2021-10-25 16:02:24 +08:00
parent 73ae17b26d
commit d662ca3f35

View File

@ -514,9 +514,8 @@ public abstract class AbstractSQLExecutor implements SQLExecutor {
protected JSONObject onPutColumn(@NotNull SQLConfig config, @NotNull ResultSet rs, @NotNull ResultSetMetaData rsmd
, final int tablePosition, @NotNull JSONObject table, final int columnIndex, Map<String, JSONObject> childMap) throws Exception {
if (rsmd.getColumnName(columnIndex).startsWith("_")) {
Log.i(TAG, "select while (rs.next()){ ..."
+ " >> rsmd.getColumnName(i).startsWith(_) >> continue;");
if (isHideColumn(config, rs, rsmd, tablePosition, table, columnIndex, childMap)) {
Log.i(TAG, "onPutColumn isHideColumn(config, rs, rsmd, tablePosition, table, columnIndex, childMap) >> return table;");
return table;
}
@ -573,6 +572,22 @@ public abstract class AbstractSQLExecutor implements SQLExecutor {
return table;
}
/**如果不需要这个功能在子类重写并直接 return false; 来提高性能
* @param config
* @param rs
* @param rsmd
* @param tablePosition
* @param table
* @param columnIndex
* @param childMap
* @return
* @throws SQLException
*/
protected boolean isHideColumn(@NotNull SQLConfig config, @NotNull ResultSet rs, @NotNull ResultSetMetaData rsmd
, final int tablePosition, @NotNull JSONObject table, final int columnIndex, Map<String, JSONObject> childMap) throws SQLException {
return rsmd.getColumnName(columnIndex).startsWith("_");
}
/**resultList.put(position, table);
* @param config
* @param rs