Java 类org.springframework.jdbc.core.RowMapperResultSetExtractor 实例源码

项目:compass    文件:ShardJdbcTemplate.java   
@SuppressWarnings("rawtypes")
private ShardOperationProcessor<List> getNonAggregationProcessor(final RowMapper rowMapper) {
       final List<QueryCallable<List>> callableList = new ArrayList<ShardJdbcTemplate.QueryCallable<List>>();

       ShardOperationProcessor<List> processor = new ShardOperationProcessor<List>() {
           @SuppressWarnings("unchecked")
        @Override
           public void addOperation(Shard shard, String sql, Object[] args) {
               ResultSetExtractor extractor = new RowMapperResultSetExtractor(rowMapper);
               QueryCallable<List> callable = new QueryCallable<List>(shard, sql, args, extractor);

               callableList.add(callable);
           }

        @Override
           public List processOperations() {
               List<List> rawResultList = ShardJdbcTemplate.this.executeQuery(callableList);
               return AggregationUtil.aggregateObjectList(rawResultList);
           }
       };

       return processor;
   }
项目:Gargoyle    文件:DbUtil.java   
public static <T> List<T> selectBeans(final Connection con, final String sql, int fetchCount, int limitedSize, RowMapper<T> mapper)
        throws Exception {
    List<T> resultList = Collections.emptyList();

    try {
        noticeQuery(sql);

        PreparedStatement prepareStatement = null;
        ResultSet executeQuery = null;

        /* 쿼리 타임아웃 시간 설정 SEC */
        // int queryTimeout = getQueryTimeout();

        prepareStatement = con.prepareStatement(sql);
        LOGGER.debug(sql);
        // postgre-sql can't
        // prepareStatement.setQueryTimeout(queryTimeout);
        if (!(limitedSize <= 0)) {
            prepareStatement.setMaxRows(limitedSize);
        }

        if (fetchCount > 0) {
            prepareStatement.setFetchSize(fetchCount);
        }
        executeQuery = prepareStatement.executeQuery();

        RowMapperResultSetExtractor<T> rowMapperResultSetExtractor = new RowMapperResultSetExtractor<T>(mapper);
        resultList = rowMapperResultSetExtractor.extractData(executeQuery);
    } catch (Throwable e) {
        throw e;
    } finally {
        close(con);
    }
    return resultList;
}
项目:shyft-extractor    文件:FetchPrimaryKeys.java   
@SneakyThrows
public Stream<PrimaryKey> ofTable(final Table table) {
    log.info("About to fetch column metadata for " + table.name);
    try (Connection connection = dataSource.getConnection();
         ResultSet resultSet = connection.getMetaData().getPrimaryKeys(null, null, table.name)) {
        List<PrimaryKey> primaryKeys = new RowMapperResultSetExtractor<>(toPrimaryKey()).extractData(resultSet);

        return primaryKeys.stream();
    }
}
项目:shyft-extractor    文件:UniqueIndex.java   
private Stream<Option<ColumnAndIndex>> columnAndIndexOptions(Schema schema, Table table) throws SQLException {
    log.info("About to fetch column and index metadata for " + table.name);

    try (Connection connection = dataSource.getConnection();
         ResultSet resultSet = connection.getMetaData().getIndexInfo(null, schema.name, table.name, true, true)) {
        return iterableStream(new RowMapperResultSetExtractor<>(toColumnAndIndexOption()).extractData(resultSet));
    }
}
项目:petit    文件:InsertStatement.java   
/**
 * @param ps
 * @throws SQLException
 */
private void extractKeys(PreparedStatement ps) throws SQLException {
    ResultSet keys = ps.getGeneratedKeys();
    if (keys != null) {
        try {
            RowMapperResultSetExtractor<Map<String, Object>> rse = new RowMapperResultSetExtractor<Map<String, Object>>(
                    new InsertKeyColumnRowMapper(TypeUtils.getRawType(idProperty.type(), null)), 1);
            keyHolder.getKeyList().addAll(rse.extractData(keys));
        } finally {
            JdbcUtils.closeResultSet(keys);
        }
    }
}
项目:springapp    文件:QueryDslSupportImpl.java   
@Transactional
@Override
public <T> PagedList<T> search(QueryConfigurer commonClause, QueryConfigurer orderByClause, long pageNo,
        long pageSz, Predicate<Long> cancelPredicate, final RowMapper<T> rowMapper,
        final Expression<?>... expressions) {
    Function<SQLQuery, List<T>> searchFunction = new Function<SQLQuery, List<T>>() {
        @Override
        public List<T> apply(SQLQuery query) {
            ResultSetExtractor<List<T>> extractor = new RowMapperResultSetExtractor<>(rowMapper);
            return getResults("search", query, extractor, expressions);
        }
    };
    return searchMain(commonClause, orderByClause, pageNo, pageSz, cancelPredicate, searchFunction);
}
项目:opennmszh    文件:JdbcWebOutageRepository.java   
private <T> T queryForObject(String sql, PreparedStatementSetter setter, RowMapper<T> rowMapper) throws DataAccessException {
    return DataAccessUtils.requiredSingleResult(jdbc().query(sql, setter, new RowMapperResultSetExtractor<T>(rowMapper, 1)));
}
项目:opennmszh    文件:JdbcWebOutageRepository.java   
private <T> List<T> queryForList(String sql, PreparedStatementSetter setter, ParameterizedRowMapper<T> rm) {
    return jdbc().query(sql, setter, new RowMapperResultSetExtractor<T>(rm));
}
项目:opennmszh    文件:JdbcWebAlarmRepository.java   
private <T> T queryForObject(String sql, PreparedStatementSetter setter, RowMapper<T> rowMapper) throws DataAccessException {
    return DataAccessUtils.requiredSingleResult(jdbc().query(sql, setter, new RowMapperResultSetExtractor<T>(rowMapper, 1)));
}
项目:opennmszh    文件:JdbcWebAlarmRepository.java   
private <T> List<T> queryForList(String sql, PreparedStatementSetter setter, ParameterizedRowMapper<T> rm) {
    return jdbc().query(sql, setter, new RowMapperResultSetExtractor<T>(rm));
}
项目:opennmszh    文件:JdbcWebEventRepository.java   
private <T> T queryForObject(String sql, PreparedStatementSetter setter, RowMapper<T> rowMapper) throws DataAccessException {
    return DataAccessUtils.requiredSingleResult(jdbc().query(sql, setter, new RowMapperResultSetExtractor<T>(rowMapper, 1)));
}
项目:opennmszh    文件:JdbcWebEventRepository.java   
private <T> List<T> queryForList(String sql, PreparedStatementSetter setter, ParameterizedRowMapper<T> rm) {
    return jdbc().query(sql, setter, new RowMapperResultSetExtractor<T>(rm));
}
项目:opennmszh    文件:JdbcWebNotificationRepository.java   
private <T> T queryForObject(String sql, PreparedStatementSetter setter, RowMapper<T> rowMapper) throws DataAccessException {
    return DataAccessUtils.requiredSingleResult(jdbc().query(sql, setter, new RowMapperResultSetExtractor<T>(rowMapper, 1)));
}
项目:opennmszh    文件:JdbcWebNotificationRepository.java   
private <T> List<T> queryForList(String sql, PreparedStatementSetter setter, ParameterizedRowMapper<T> rm) {
    return jdbc().query(sql, setter, new RowMapperResultSetExtractor<T>(rm));
}
项目:OpenNMS    文件:JdbcWebOutageRepository.java   
private <T> T queryForObject(String sql, PreparedStatementSetter setter, RowMapper<T> rowMapper) throws DataAccessException {
    return DataAccessUtils.requiredSingleResult(jdbc().query(sql, setter, new RowMapperResultSetExtractor<T>(rowMapper, 1)));
}
项目:OpenNMS    文件:JdbcWebOutageRepository.java   
private <T> List<T> queryForList(String sql, PreparedStatementSetter setter, ParameterizedRowMapper<T> rm) {
    return jdbc().query(sql, setter, new RowMapperResultSetExtractor<T>(rm));
}
项目:OpenNMS    文件:JdbcWebEventRepository.java   
private <T> T queryForObject(String sql, PreparedStatementSetter setter, RowMapper<T> rowMapper) throws DataAccessException {
    return DataAccessUtils.requiredSingleResult(jdbc().query(sql, setter, new RowMapperResultSetExtractor<T>(rowMapper, 1)));
}
项目:OpenNMS    文件:JdbcWebEventRepository.java   
private <T> List<T> queryForList(String sql, PreparedStatementSetter setter, ParameterizedRowMapper<T> rm) {
    return jdbc().query(sql, setter, new RowMapperResultSetExtractor<T>(rm));
}
项目:OpenNMS    文件:JdbcWebNotificationRepository.java   
private <T> T queryForObject(String sql, PreparedStatementSetter setter, RowMapper<T> rowMapper) throws DataAccessException {
    return DataAccessUtils.requiredSingleResult(jdbc().query(sql, setter, new RowMapperResultSetExtractor<T>(rowMapper, 1)));
}
项目:OpenNMS    文件:JdbcWebNotificationRepository.java   
private <T> List<T> queryForList(String sql, PreparedStatementSetter setter, ParameterizedRowMapper<T> rm) {
    return jdbc().query(sql, setter, new RowMapperResultSetExtractor<T>(rm));
}