Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

limit在多个查询中,只有一个结果集不为空时,返回的分页结果不对 #239

Closed
yanlizhang opened this issue Apr 5, 2017 · 5 comments

Comments

@yanlizhang
Copy link

limit查询如:limit 20,10,查询到多个结果集,其中只有一个不为空时,在ShardingResultSets中filterResultSets方法返回的list只有一个结果集:

private List<ResultSet> filterResultSets(final List<ResultSet> resultSets) throws SQLException {
        List<ResultSet> result = new ArrayList<>(resultSets.size());
        for (ResultSet each : resultSets) {
            if (each.next()) {
                result.add(new WrapperResultSet(each));
            }
        }
        return result;
    }

此时,type值为SINGLE。

private Type generateType() {
        if (this.resultSets.isEmpty()) {
            return Type.EMPTY;
        } else if (1 == this.resultSets.size()) {
            return Type.SINGLE;
        } else {
            return Type.MULTIPLE;
        }
    }

此时直接返回了唯一的结果集(limit 0,30)

@ManderLS
Copy link

这个问题1.3.1的时候 我也遇到了 但是升级了1.4.2之后 这个问题解决了

@leojames
Copy link

1.4.2依然没有解决,看了源码我改了一下Merge的代码解决了。
我上传下代码吧
ResultSetFactory.java.zip

@javaeedll
Copy link

leojames 这个适用于哪个版本?

@leojames
Copy link

leojames commented Jun 1, 2017

适用于1.4.2版本 目前线上这个BUG已经修复了 你们下个版本也一起发布下吧

terrymanu added a commit that referenced this issue Jun 26, 2017
@terrymanu
Copy link
Member

fixed at 1.5.0.M2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants