@Override public Void visitShowGrants(ShowGrants node, Integer indent) { builder.append("SHOW GRANTS "); if (node.getTableName().isPresent()) { builder.append("ON "); if (node.getTable()) { builder.append("TABLE "); } builder.append(node.getTableName().get()); } return null; }
@Override public Node visitShowGrants(SqlBaseParser.ShowGrantsContext context) { Optional<QualifiedName> tableName = Optional.empty(); if (context.qualifiedName() != null) { tableName = Optional.of(getQualifiedName(context.qualifiedName())); } return new ShowGrants( getLocation(context), context.TABLE() != null, tableName); }
Optional<Expression> predicate = Optional.empty(); Optional<QualifiedName> tableName = showGrants.getTableName(); if (tableName.isPresent()) { QualifiedObjectName qualifiedTableName = createQualifiedObjectName(session, showGrants, tableName.get());
@Override public Void visitShowGrants(ShowGrants node, Integer indent) { builder.append("SHOW GRANTS "); if (node.getTableName().isPresent()) { builder.append("ON "); if (node.getTable()) { builder.append("TABLE "); } builder.append(node.getTableName().get()); } return null; }
@Test public void testShowGrants() { assertStatement("SHOW GRANTS ON TABLE t", new ShowGrants(true, Optional.of(QualifiedName.of("t")))); assertStatement("SHOW GRANTS ON t", new ShowGrants(false, Optional.of(QualifiedName.of("t")))); assertStatement("SHOW GRANTS", new ShowGrants(false, Optional.empty())); }
@Override public Void visitShowGrants(ShowGrants node, Integer indent) { builder.append("SHOW GRANTS "); if (node.getTableName().isPresent()) { builder.append("ON "); if (node.getTable()) { builder.append("TABLE "); } builder.append(node.getTableName().get()); } return null; }
@Override public Node visitShowGrants(SqlBaseParser.ShowGrantsContext context) { Optional<QualifiedName> tableName = Optional.empty(); if (context.qualifiedName() != null) { tableName = Optional.of(getQualifiedName(context.qualifiedName())); } return new ShowGrants( getLocation(context), context.TABLE() != null, tableName); }
@Test public void testShowGrants() { assertStatement("SHOW GRANTS ON TABLE t", new ShowGrants(true, Optional.of(QualifiedName.of("t")))); assertStatement("SHOW GRANTS ON t", new ShowGrants(false, Optional.of(QualifiedName.of("t")))); assertStatement("SHOW GRANTS", new ShowGrants(false, Optional.empty())); }