@Override protected Void visitSelect(Select node, Integer indent) { super.visitSelect(node, indent); if (_createTempTable == true) { builder.append("INTO ").append(getIdenSurroundingSymbolLeft()) .append(caseSensitivityName(_tempTableName)).append(getIdenSurroundingSymbolRight()) .append("\n"); } return null; }
@Override protected Void visitSelect(Select node, Integer indent) { append(indent, "SELECT"); if (node.isDistinct()) { builder.append(" DISTINCT"); } if (node.getSelectItems().size() > 1) { boolean first = true; for (SelectItem item : node.getSelectItems()) { builder.append("\n") .append(indentString(indent)) .append(first ? " " : ", "); process(item, indent); first = false; } } else { builder.append(' '); process(getOnlyElement(node.getSelectItems()), indent); } builder.append('\n'); return null; }
public static Select selectList(Expression... expressions) { ImmutableList.Builder<SelectItem> items = ImmutableList.builder(); for (Expression expression : expressions) { items.add(new SingleColumn(expression)); } return new Select(false, items.build()); }
public static Query simpleQuery(Select select, Relation from, Optional<Expression> where, List<GroupingElement> groupBy, Optional<Expression> having, List<SortItem> ordering, Optional<String> limit) { return query(new QuerySpecification( select, Optional.of(from), where, groupBy, having, ordering, limit)); }
public static Select selectList(SelectItem... items) { return new Select(false, ImmutableList.copyOf(items)); }
public static Select selectAll(List<SelectItem> items) { return new Select(false, items); }
public static Query simpleQuery(Select select, Relation from) { return simpleQuery(select, from, Optional.empty(), ImmutableList.of()); }
public static Query simpleQuery(Select select, Relation from, List<SortItem> ordering) { return simpleQuery(select, from, Optional.empty(), ordering); }
public static Query simpleQuery(Select select, Relation from, Expression where) { return simpleQuery(select, from, Optional.of(where), ImmutableList.of()); }
public static Query simpleQuery(Select select, Relation from, Expression where, List<SortItem> ordering) { return simpleQuery(select, from, Optional.of(where), ordering); }
public static Query simpleQuery(Select select, Relation from, Optional<Expression> where, List<SortItem> ordering) { return simpleQuery(select, from, where, ImmutableList.of(), Optional.empty(), ordering, Optional.empty()); }