/** * Prepares the selection to use for the statement. * * @param cfm the table metadata * @param boundNames the bound names * @return the selection to use for the statement */ private Selection prepareSelection(CFMetaData cfm, VariableSpecifications boundNames) { boolean hasGroupBy = !parameters.groups.isEmpty(); if (selectClause.isEmpty()) return hasGroupBy ? Selection.wildcardWithGroupBy(cfm, boundNames) : Selection.wildcard(cfm); return Selection.fromSelectors(cfm, selectClause, boundNames, hasGroupBy); }
/** * Prepares the selection to use for the statement. * * @param cfm the table metadata * @param boundNames the bound names * @return the selection to use for the statement */ private Selection prepareSelection(CFMetaData cfm, VariableSpecifications boundNames) { boolean hasGroupBy = !parameters.groups.isEmpty(); if (selectClause.isEmpty()) return hasGroupBy ? Selection.wildcardWithGroupBy(cfm, boundNames) : Selection.wildcard(cfm); return Selection.fromSelectors(cfm, selectClause, boundNames, hasGroupBy); }
public static Selection wildcardWithGroupBy(CFMetaData cfm, VariableSpecifications boundNames) { List<RawSelector> rawSelectors = new ArrayList<>(cfm.allColumns().size()); Iterator<ColumnDefinition> iter = cfm.allColumnsInSelectOrder(); while (iter.hasNext()) { ColumnDefinition.Raw raw = ColumnDefinition.Raw.forColumn(iter.next()); rawSelectors.add(new RawSelector(raw, null)); } return fromSelectors(cfm, rawSelectors, boundNames, true); }
public static Selection wildcardWithGroupBy(CFMetaData cfm, VariableSpecifications boundNames) { List<RawSelector> rawSelectors = new ArrayList<>(cfm.allColumns().size()); Iterator<ColumnDefinition> iter = cfm.allColumnsInSelectOrder(); while (iter.hasNext()) { ColumnDefinition.Raw raw = ColumnDefinition.Raw.forColumn(iter.next()); rawSelectors.add(new RawSelector(raw, null)); } return fromSelectors(cfm, rawSelectors, boundNames, true); }
: Selection.fromSelectors(cfm, selectClause, boundNames, !parameters.groups.isEmpty());