All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.javaclub.cdl.client.matrix.jdbc.adapter.AbstractResultSetAdapter Maven / Gradle / Ivy

The newest version!

package com.github.javaclub.cdl.client.matrix.jdbc.adapter;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
import java.util.List;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 处理多结果集的适配器.
 * 
 */
@RequiredArgsConstructor
public abstract class AbstractResultSetAdapter extends AbstractResultSetGetterAdapter {
    
    @Getter
    private final List resultSets;
    
    private boolean closed;
    
    
    
    @Override
    public final void close() throws SQLException {
        for (ResultSet each : resultSets) {
            each.close();
        }
        closed = true;
    }
    
    @Override
    public final boolean isClosed() throws SQLException {
        return closed;
    }
    
    @Override
    public final boolean wasNull() throws SQLException {
        return getCurrentResultSet().wasNull();
    }
    
    @Override
    public final int getFetchDirection() throws SQLException {
        return getCurrentResultSet().getFetchDirection();
    }
    
    @Override
    public final void setFetchDirection(final int direction) throws SQLException {
        for (ResultSet each : resultSets) {
            each.setFetchDirection(direction);
        }
    }
    
    @Override
    public final int getFetchSize() throws SQLException {
        return getCurrentResultSet().getFetchSize();
    }
    
    @Override
    public final void setFetchSize(final int rows) throws SQLException {
        for (ResultSet each : resultSets) {
            each.setFetchSize(rows);
        }
    }
    
    @Override
    public final int getType() throws SQLException {
        return getCurrentResultSet().getType();
    }
    
    @Override
    public final int getConcurrency() throws SQLException {
        return getCurrentResultSet().getConcurrency();
    }
    
    @Override
    public final Statement getStatement() throws SQLException {
        return getCurrentResultSet().getStatement();
    }
    
    @Override
    public final SQLWarning getWarnings() throws SQLException {
        return getCurrentResultSet().getWarnings();
    }
    
    @Override
    public final void clearWarnings() throws SQLException {
        getCurrentResultSet().clearWarnings();
    }
    
    @Override
    public final ResultSetMetaData getMetaData() throws SQLException {
        return getCurrentResultSet().getMetaData();
    }
    
    @Override
    public final int findColumn(final String columnLabel) throws SQLException {
        return getCurrentResultSet().findColumn(columnLabel);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy