Skip to content

Commit

Permalink
[ISSUE alibaba#4311] Fix Derby data source related SQL LIMIT exception (
Browse files Browse the repository at this point in the history
alibaba#4313)

* for alibaba#4311,Fixed Derby data source related SQL LIMIT exception.

* fix code style.

* code format.
  • Loading branch information
Maijh97 authored Nov 24, 2020
1 parent 7f2a330 commit 3bf8844
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1116,16 +1116,26 @@ public int configInfoTagCount() {

@Override
public List<String> getTenantIdList(int page, int pageSize) {
String sql = "SELECT tenant_id FROM config_info WHERE tenant_id != '' GROUP BY tenant_id LIMIT ?, ?";
PaginationHelper<String> helper = createPaginationHelper();

String sql = "SELECT tenant_id FROM config_info WHERE tenant_id != '' GROUP BY tenant_id LIMIT ?,?";
int from = (page - 1) * pageSize;
return databaseOperate.queryMany(sql, new Object[] {from, pageSize}, String.class);

Page<String> pageList = helper.fetchPageLimit(sql, new Object[] {from, pageSize}, page, pageSize,
(resultSet, i) -> resultSet.getString("tenant_id"));
return pageList.getPageItems();
}

@Override
public List<String> getGroupIdList(int page, int pageSize) {
String sql = "SELECT group_id FROM config_info WHERE tenant_id ='' GROUP BY group_id LIMIT ?, ?";
PaginationHelper<String> helper = createPaginationHelper();

String sql = "SELECT group_id FROM config_info WHERE tenant_id ='' GROUP BY group_id LIMIT ?,?";
int from = (page - 1) * pageSize;
return databaseOperate.queryMany(sql, new Object[] {from, pageSize}, String.class);

Page<String> pageList = helper.fetchPageLimit(sql, new Object[] {from, pageSize}, page, pageSize,
(resultSet, i) -> resultSet.getString("group_id"));
return pageList.getPageItems();
}

@Override
Expand Down

0 comments on commit 3bf8844

Please sign in to comment.