public static Identifier quotedIdentifier(String name) { return new Identifier(name, true); }
@Override protected Void visitIdentifier(Identifier node, ImmutableSet.Builder<QualifiedName> builder) { builder.add(QualifiedName.of(node.getValue())); return null; } }
@Override protected String visitIdentifier(Identifier node, Void context) { if (!node.isDelimited()) { return node.getValue(); } else { return '"' + node.getValue().replace("\"", "\"\"") + '"'; } }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Use use = (Use) o; if (!catalog.equals(use.catalog)) { return false; } if (!schema.equals(use.schema)) { return false; } return true; }
@Override protected String visitIdentifier(Identifier node, Void context) { if (!node.isDelimited()) { return node.getValue(); } else { return '"' + node.getValue().replace("\"", "\"\"") + '"'; } }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Use use = (Use) o; if (!catalog.equals(use.catalog)) { return false; } if (!schema.equals(use.schema)) { return false; } return true; }
public static Identifier identifier(String name) { return new Identifier(name); }
@Override public Expression rewriteIdentifier(Identifier node, Void context, ExpressionTreeRewriter<Void> treeRewriter) { return new SymbolReference(node.getValue()); }
private static String formatName(Identifier name) { String delimiter = name.isDelimited() ? "\"" : ""; return delimiter + name.getValue().replace("\"", "\"\"") + delimiter; }
public static Identifier identifier(String name) { return new Identifier(name); }
@Override public Expression rewriteIdentifier(Identifier node, Void context, ExpressionTreeRewriter<Void> treeRewriter) { return new SymbolReference(node.getValue()); }
public static Identifier quotedIdentifier(String name) { return new Identifier(name, true); }
@Override protected Void visitIdentifier(Identifier node, Integer indentLevel) { QualifiedName resolved = resolvedNameReferences.get(node); String resolvedName = ""; if (resolved != null) { resolvedName = "=>" + resolved.toString(); } print(indentLevel, "Identifier[" + node.getValue() + resolvedName + "]"); return null; }
public static Expression from(QualifiedName name) { Expression result = null; for (String part : name.getParts()) { if (result == null) { result = new Identifier(part); } else { result = new DereferenceExpression(result, new Identifier(part)); } } return result; }
private QualifiedName(List<Identifier> originalParts) { this.originalParts = originalParts; this.parts = originalParts.stream().map(identifier -> identifier.getValue().toLowerCase(ENGLISH)).collect(toImmutableList()); }
private static String formatPrincipal(PrincipalSpecification principal) { PrincipalSpecification.Type type = principal.getType(); switch (type) { case UNSPECIFIED: return principal.getName().toString(); case USER: case ROLE: return format("%s %s", type.name(), principal.getName().toString()); default: throw new IllegalArgumentException("Unsupported principal type: " + type); } }