public static AnsiSelectBuilder from(final SqlGrammar grammar, final Definition definition) { return new AnsiSelectBuilder( grammar, grammar.selectExpression( Option.<SetQuantifier>none(), definition.fields(), definition, Option.<Predicate<? super Record>>none(), Option.<Comparator<? super Record>>none(), Option.<Sequence<? extends Keyword<?>>>none(), none(Integer.class), none(Integer.class))); }
@Override public AnsiSelectBuilder count() { return from( grammar, selectExpression( expression.setQuantifier(), grammar.selectList(countStar()), expression.fromClause(), expression.whereClause(), Option.<OrderByClause>none(), expression.groupByClause(), expression.offsetClause(), expression.fetchClause())); }
@Override public AnsiSelectBuilder fetch(int number) { return from( grammar, selectExpression( expression.setQuantifier(), expression.selectList(), expression.fromClause(), expression.whereClause(), expression.orderByClause(), expression.groupByClause(), expression.offsetClause(), some(grammar.fetchClause(number)))); }
@Override public AnsiSelectBuilder filter(final Predicate<? super Record> predicate) { return filter(grammar.whereClause(predicate)); }
@Override public AnsiSelectBuilder select(final Sequence<? extends Keyword<?>> columns) { if (columns.isEmpty()) return this; return select(grammar.selectList(columns)); }
@Override public ExpressionBuilder join(Join join) { return grammar.join(this, join); }
@Override public AnsiSelectBuilder groupBy(Sequence<? extends Keyword<?>> columns) { return groupBy(grammar.groupByClause(columns)); }
@Override public AnsiSelectBuilder orderBy(final Comparator<? super Record> comparator) { return orderBy(grammar.orderByClause(comparator)); }