use of org.jooq.Result in project commons-dao by reportportal.
the class WidgetContentRepositoryTest method productStatusFilterGroupedWidgetSorting.
@Test
void productStatusFilterGroupedWidgetSorting() {
String sortingColumn = "statistics$defects$no_defect$nd001";
Filter filter = buildDefaultFilter(1L);
List<Sort.Order> orders = filter.getTarget().getCriteriaHolders().stream().map(ch -> new Sort.Order(Sort.Direction.ASC, ch.getFilterCriteria())).collect(Collectors.toList());
orders.add(new Sort.Order(Sort.Direction.DESC, sortingColumn));
Sort sort = Sort.by(orders);
Map<Filter, Sort> filterSortMapping = Maps.newLinkedHashMap();
filterSortMapping.put(buildDefaultFilter(1L), sort);
filterSortMapping.put(buildDefaultTestFilter(1L), sort);
Map<String, String> tags = new LinkedHashMap<>();
tags.put("firstColumn", "build");
tags.put("secondColumn", "hello");
Map<String, List<ProductStatusStatisticsContent>> result = widgetContentRepository.productStatusGroupedByFilterStatistics(filterSortMapping, buildProductStatusContentFields(), tags, false, 10);
assertNotNull(result);
}
use of org.jooq.Result in project commons-dao by reportportal.
the class WidgetContentRepositoryTest method productStatusLaunchGroupedWidgetSorting.
@Test
void productStatusLaunchGroupedWidgetSorting() {
String sortingColumn = "statistics$defects$no_defect$nd001";
Filter filter = buildDefaultTestFilter(1L);
List<Sort.Order> orders = filter.getTarget().getCriteriaHolders().stream().map(ch -> new Sort.Order(Sort.Direction.ASC, ch.getFilterCriteria())).collect(Collectors.toList());
orders.add(new Sort.Order(Sort.Direction.DESC, sortingColumn));
Sort sort = Sort.by(orders);
Map<String, String> tags = new LinkedHashMap<>();
tags.put("firstColumn", "build");
tags.put("secondColumn", "hello");
List<ProductStatusStatisticsContent> result = widgetContentRepository.productStatusGroupedByLaunchesStatistics(filter, buildProductStatusContentFields(), tags, sort, false, 10);
assertNotNull(result);
}
use of org.jooq.Result in project jOOQ by jOOQ.
the class AbstractResultQuery method fetchLater.
@Override
@Deprecated
public final org.jooq.FutureResult<R> fetchLater() {
ExecutorService executor = newSingleThreadExecutor();
Future<Result<R>> future = executor.submit(new ResultQueryCallable());
return new FutureResultImpl<R>(future, executor);
}
use of org.jooq.Result in project Skree by Skelril.
the class HighScoreDatabaseUtil method getTop.
public static List<Clause<Optional<GameProfile>, Integer>> getTop(ScoreType scoreType, int count) {
try (Connection con = SQLHandle.getConnection()) {
DSLContext create = DSL.using(con);
Result<Record2<String, Integer>> results = create.select(PLAYERS.UUID, HIGH_SCORES.VALUE).from(HIGH_SCORES).join(PLAYERS).on(PLAYERS.ID.equal(HIGH_SCORES.PLAYER_ID)).where(HIGH_SCORES.SCORE_TYPE_ID.equal(scoreType.getId())).orderBy(scoreType.getOrder() == ScoreType.Order.ASC ? HIGH_SCORES.VALUE.asc() : HIGH_SCORES.VALUE.desc()).limit(count).fetch();
return results.stream().map(record -> new Clause<>(getProfile(record.getValue(PLAYERS.UUID)), record.getValue(HIGH_SCORES.VALUE))).collect(Collectors.toList());
} catch (SQLException e) {
e.printStackTrace();
}
return Lists.newArrayList();
}
use of org.jooq.Result in project jOOQ by jOOQ.
the class MySQLDatabase method getRoutines0.
@Override
protected List<RoutineDefinition> getRoutines0() throws SQLException {
List<RoutineDefinition> result = new ArrayList<>();
Result<Record6<String, String, String, byte[], byte[], ProcType>> records = is8() ? create().select(ROUTINES.ROUTINE_SCHEMA, ROUTINES.ROUTINE_NAME, ROUTINES.ROUTINE_COMMENT, inline(new byte[0]).as(PROC.PARAM_LIST), inline(new byte[0]).as(PROC.RETURNS), ROUTINES.ROUTINE_TYPE.coerce(PROC.TYPE).as(ROUTINES.ROUTINE_TYPE)).from(ROUTINES).where(ROUTINES.ROUTINE_SCHEMA.in(getInputSchemata())).orderBy(1, 2, 6).fetch() : create().select(PROC.DB.as(ROUTINES.ROUTINE_SCHEMA), PROC.NAME.as(ROUTINES.ROUTINE_NAME), PROC.COMMENT.as(ROUTINES.ROUTINE_COMMENT), PROC.PARAM_LIST, PROC.RETURNS, PROC.TYPE.as(ROUTINES.ROUTINE_TYPE)).from(PROC).where(PROC.DB.in(getInputSchemata())).orderBy(1, 2, 6).fetch();
Map<Record, Result<Record6<String, String, String, byte[], byte[], ProcType>>> groups = records.intoGroups(new Field[] { ROUTINES.ROUTINE_SCHEMA, ROUTINES.ROUTINE_NAME });
// [#1908] This indirection is necessary as MySQL allows for overloading
// procedures and functions with the same signature.
groups.forEach((k, overloads) -> {
overloads.forEach(record -> {
SchemaDefinition schema = getSchema(record.get(ROUTINES.ROUTINE_SCHEMA));
String name = record.get(ROUTINES.ROUTINE_NAME);
String comment = record.get(ROUTINES.ROUTINE_COMMENT);
String params = is8() ? "" : new String(record.get(PROC.PARAM_LIST));
String returns = is8() ? "" : new String(record.get(PROC.RETURNS));
ProcType type = record.get(ROUTINES.ROUTINE_TYPE.coerce(PROC.TYPE).as(ROUTINES.ROUTINE_TYPE));
if (overloads.size() > 1)
result.add(new MySQLRoutineDefinition(schema, name, comment, params, returns, type, "_" + type.name()));
else
result.add(new MySQLRoutineDefinition(schema, name, comment, params, returns, type, null));
});
});
return result;
}
Aggregations