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

com.jn.sqlhelper.common.resultset.SelectCountResultSetExtractor Maven / Gradle / Ivy

package com.jn.sqlhelper.common.resultset;

import java.sql.ResultSet;
import java.sql.SQLException;

public class SelectCountResultSetExtractor implements ResultSetExtractor {
    public static final SelectCountResultSetExtractor INSTANCE = new SelectCountResultSetExtractor();
    @Override
    public Integer extract(ResultSet rs) throws SQLException {
        if (rs.next() && rs.getMetaData().getColumnCount() > 0) {
            return rs.getInt(1);
        } else {
            return 0;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy