use of com.torodb.backend.d2r.ResultSetDocPartResult in project torodb by torodb.
the class AbstractReadInterface method getCollectionResultSets.
@Override
@SuppressFBWarnings(value = { "OBL_UNSATISFIED_OBLIGATION", "ODR_OPEN_DATABASE_RESOURCE" }, justification = "ResultSet is wrapped in a DocPartResult. It's iterated and closed in caller code")
public List<DocPartResult> getCollectionResultSets(DSLContext dsl, MetaDatabase metaDatabase, MetaCollection metaCollection, Collection<Integer> dids) throws SQLException {
ArrayList<DocPartResult> result = new ArrayList<>();
Connection connection = dsl.configuration().connectionProvider().acquire();
try {
Iterator<? extends MetaDocPart> metaDocPartIterator = metaCollection.streamContainedMetaDocParts().sorted(TableRefComparator.MetaDocPart.DESC).iterator();
while (metaDocPartIterator.hasNext()) {
MetaDocPart metaDocPart = metaDocPartIterator.next();
String statament = getDocPartStatament(metaDatabase, metaDocPart, dids);
PreparedStatement preparedStatement = connection.prepareStatement(statament);
result.add(new ResultSetDocPartResult(metaDataReadInterface, dataTypeProvider, errorHandler, metaDocPart, preparedStatement.executeQuery(), sqlHelper));
}
} finally {
dsl.configuration().connectionProvider().release(connection);
}
return result;
}
Aggregations