Fix some derby datasource plugin sql problem.

This commit is contained in:
KomachiSion 2022-10-24 19:53:44 +08:00
parent b637b63bd8
commit 3cf00c7ccb
3 changed files with 24 additions and 22 deletions

View File

@ -20,6 +20,7 @@ server.servlet.contextPath=/nacos
### Include message field
server.error.include-message=ALWAYS
### Default web server port:
server.port=8848
#*************** Network Related Configurations ***************#
### If prefer hostname over ip for Nacos server addresses in cluster.conf:

View File

@ -34,11 +34,11 @@ import java.util.Map;
public class ConfigInfoMapperByDerby implements ConfigInfoMapper {
private static final String DATA_ID = "data_id";
private static final String DATA_ID = "dataId";
private static final String GROUP = "group_id";
private static final String GROUP = "group";
private static final String APP_NAME = "app_name";
private static final String APP_NAME = "appName";
private static final String CONTENT = "content";
@ -89,7 +89,8 @@ public class ConfigInfoMapperByDerby implements ConfigInfoMapper {
@Override
public String findConfigInfoByDataIdAndAppFetchRows(int startRow, int pageSize) {
return "SELECT id,data_id,group_id,tenant_id,app_name,content FROM config_info WHERE data_id = ? AND "
+ "tenant_id = ? AND app_name = ?" + " OFFSET " + startRow + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY";
+ "tenant_id = ? AND app_name = ?" + " OFFSET " + startRow + " ROWS FETCH NEXT " + pageSize
+ " ROWS ONLY";
}
@Override
@ -190,9 +191,8 @@ public class ConfigInfoMapperByDerby implements ConfigInfoMapper {
}
@Override
public String findChangeConfigFetchRows(
Map<String, String> params, final Timestamp startTime, final Timestamp endTime,
int startRow, int pageSize, long lastMaxId) {
public String findChangeConfigFetchRows(Map<String, String> params, final Timestamp startTime,
final Timestamp endTime, int startRow, int pageSize, long lastMaxId) {
final String tenant = params.get(TENANT);
final String dataId = params.get(DATA_ID);
final String group = params.get(GROUP);
@ -464,8 +464,8 @@ public class ConfigInfoMapperByDerby implements ConfigInfoMapper {
@Override
public String findConfigInfoBaseByDataIdFetchRows(int startRow, int pageSize) {
return "SELECT id,data_id,group_id,content FROM config_info WHERE data_id=? "
+ "AND tenant_id=?" + " OFFSET " + startRow + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY";
return "SELECT id,data_id,group_id,content FROM config_info WHERE data_id=? " + "AND tenant_id=?" + " OFFSET "
+ startRow + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY";
}
@Override
@ -518,8 +518,8 @@ public class ConfigInfoMapperByDerby implements ConfigInfoMapper {
@Override
public String findConfigInfoBaseByGroupFetchRows(int startRow, int pageSize) {
return "SELECT id,data_id,group_id,content FROM config_info WHERE group_id=? "
+ "AND tenant_id=?" + " OFFSET " + startRow + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY";
return "SELECT id,data_id,group_id,content FROM config_info WHERE group_id=? " + "AND tenant_id=?" + " OFFSET "
+ startRow + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY";
}
@Override
@ -527,7 +527,7 @@ public class ConfigInfoMapperByDerby implements ConfigInfoMapper {
final String appName = params.get("appName");
final String content = params.get("content");
final String dataId = params.get("dataId");
final String group = params.get("groupId");
final String group = params.get(GROUP);
final String sqlCountRows = "SELECT count(*) FROM config_info";
StringBuilder where = new StringBuilder(" WHERE ");
where.append(" tenant_id LIKE ? ");
@ -629,7 +629,8 @@ public class ConfigInfoMapperByDerby implements ConfigInfoMapper {
@Override
public String findConfigInfoByDataId2Group2Tenant() {
return "SELECT id,data_id,group_id,tenant_id,app_name,content FROM config_info WHERE id=?";
return "SELECT id,data_id,group_id,tenant_id,app_name,content,md5,type,encrypted_data_key FROM config_info "
+ "WHERE data_id=? AND group_id=? AND tenant_id=?";
}
@Override

View File

@ -53,7 +53,7 @@ public class HistoryConfigInfoMapperByDerby implements HistoryConfigInfoMapper {
@Override
public String findConfigHistoryCountRows() {
return "SELECT count(*) FROM his_config_info WHERE gmt_modified < ?";
return "SELECT count(*) FROM his_config_info WHERE data_id = ? AND group_id = ? AND tenant_id = ?";
}
@Override