// Path: src/main/java/com/elong/pb/newdda/client/router/result/merge/resultset/WrapperResultSet.java
// public class WrapperResultSet extends AbstractDelegateResultSet {
// 
//     public WrapperResultSet(final ResultSet resultSetWhenNextOnce) throws SQLException {
//         super(Collections.singletonList(resultSetWhenNextOnce));
//     }
// 
//     @Override
//     protected boolean firstNext() throws SQLException {
//         return true;
//     }
// 
//     @Override
//     protected boolean afterFirstNext() throws SQLException {
//         return getDelegate().next();
//     }
// 
// }


import com.elong.pb.newdda.client.router.result.merge.resultset.WrapperResultSet;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
package com.elong.pb.newdda.client.jdbc;



/**
 * Created by zhangyong on 2016/10/9.
 */
public class ShardingResultSets {

    private final List<ResultSet> resultSets;

    private ResultSetOperateType resultSetOperateType;

    public ShardingResultSets(final List<ResultSet> resultSets) throws SQLException {
        this.resultSets = filterResultSets(resultSets);
        this.resultSetOperateType = generateType();
    }

    private List<ResultSet> filterResultSets(final List<ResultSet> resultSets) throws SQLException {
        List<ResultSet> result = new ArrayList<ResultSet>(resultSets.size());
        for (ResultSet each : resultSets) {
            if (each.next()) {
// Path: src/main/java/com/elong/pb/newdda/client/router/result/merge/resultset/WrapperResultSet.java
// public class WrapperResultSet extends AbstractDelegateResultSet {
// 
//     public WrapperResultSet(final ResultSet resultSetWhenNextOnce) throws SQLException {
//         super(Collections.singletonList(resultSetWhenNextOnce));
//     }
// 
//     @Override
//     protected boolean firstNext() throws SQLException {
//         return true;
//     }
// 
//     @Override
//     protected boolean afterFirstNext() throws SQLException {
//         return getDelegate().next();
//     }
// 
// }


// Path: src/main/java/com/elong/pb/newdda/client/jdbc/ShardingResultSets.java
import com.elong.pb.newdda.client.router.result.merge.resultset.WrapperResultSet;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

package com.elong.pb.newdda.client.jdbc;



/**
 * Created by zhangyong on 2016/10/9.
 */
public class ShardingResultSets {

    private final List<ResultSet> resultSets;

    private ResultSetOperateType resultSetOperateType;

    public ShardingResultSets(final List<ResultSet> resultSets) throws SQLException {
        this.resultSets = filterResultSets(resultSets);
        this.resultSetOperateType = generateType();
    }

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