Java 类org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource 实例源码

项目:pulsar-reporting-api    文件:RDBMS.java   
public <T> List<T> query(String sql, AbstractSqlParameterSource parameters,final int maxrows,final RowMapper<T> mapper){
    return this.namedParameterJdbcTemplate.query(sql, parameters, new ResultSetExtractor<List<T>>(){
@Override
public List<T> extractData(ResultSet rs) throws SQLException,
        DataAccessException {
    List<T> data = new ArrayList<T>();
       if(rs==null) return data;
       int rowNum = 0;
       while((maxrows>0 && rowNum<maxrows || maxrows<0) && rs.next()){
        data.add(mapper.mapRow(rs, rowNum++));
       }
       return data;
}
    });
 }