Search in sources :

Example 1 with DropFunction

use of io.crate.sql.tree.DropFunction in project crate by crate.

the class TestStatementBuilder method printStatement.

private static void printStatement(String sql) {
    println(sql.trim());
    println("");
    Statement statement = SqlParser.createStatement(sql);
    println(statement.toString());
    println("");
    // TODO: support formatting all statement types
    if (statement instanceof Query || statement instanceof CreateTable || statement instanceof CopyFrom || statement instanceof SwapTable || statement instanceof GCDanglingArtifacts || statement instanceof CreateFunction || statement instanceof CreateUser || statement instanceof GrantPrivilege || statement instanceof DenyPrivilege || statement instanceof RevokePrivilege || statement instanceof DropUser || statement instanceof DropAnalyzer || statement instanceof DropFunction || statement instanceof DropTable || statement instanceof DropBlobTable || statement instanceof DropView || statement instanceof DropRepository || statement instanceof DropSnapshot || statement instanceof Update || statement instanceof Insert || statement instanceof SetSessionAuthorizationStatement || statement instanceof Window) {
        println(SqlFormatter.formatSql(statement));
        println("");
        assertFormattedSql(statement);
    }
    println("=".repeat(60));
    println("");
}
Also used : SetSessionAuthorizationStatement(io.crate.sql.tree.SetSessionAuthorizationStatement) Window(io.crate.sql.tree.Window) Query(io.crate.sql.tree.Query) GCDanglingArtifacts(io.crate.sql.tree.GCDanglingArtifacts) SetStatement(io.crate.sql.tree.SetStatement) CommitStatement(io.crate.sql.tree.CommitStatement) DeallocateStatement(io.crate.sql.tree.DeallocateStatement) BeginStatement(io.crate.sql.tree.BeginStatement) Statement(io.crate.sql.tree.Statement) KillStatement(io.crate.sql.tree.KillStatement) SetSessionAuthorizationStatement(io.crate.sql.tree.SetSessionAuthorizationStatement) CreateFunction(io.crate.sql.tree.CreateFunction) DropView(io.crate.sql.tree.DropView) ShowCreateTable(io.crate.sql.tree.ShowCreateTable) CreateTable(io.crate.sql.tree.CreateTable) DropUser(io.crate.sql.tree.DropUser) CreateUser(io.crate.sql.tree.CreateUser) DenyPrivilege(io.crate.sql.tree.DenyPrivilege) DropRepository(io.crate.sql.tree.DropRepository) DropTable(io.crate.sql.tree.DropTable) Update(io.crate.sql.tree.Update) Insert(io.crate.sql.tree.Insert) DropAnalyzer(io.crate.sql.tree.DropAnalyzer) GrantPrivilege(io.crate.sql.tree.GrantPrivilege) DropBlobTable(io.crate.sql.tree.DropBlobTable) CopyFrom(io.crate.sql.tree.CopyFrom) DropSnapshot(io.crate.sql.tree.DropSnapshot) RevokePrivilege(io.crate.sql.tree.RevokePrivilege) DropFunction(io.crate.sql.tree.DropFunction) SwapTable(io.crate.sql.tree.SwapTable)

Example 2 with DropFunction

use of io.crate.sql.tree.DropFunction in project crate by crate.

the class AstBuilder method visitDropFunction.

@Override
public Node visitDropFunction(SqlBaseParser.DropFunctionContext context) {
    QualifiedName functionName = getQualifiedName(context.name);
    validateFunctionName(functionName);
    return new DropFunction(functionName, context.EXISTS() != null, visitCollection(context.functionArgument(), FunctionArgument.class));
}
Also used : QualifiedName(io.crate.sql.tree.QualifiedName) FunctionArgument(io.crate.sql.tree.FunctionArgument) DropFunction(io.crate.sql.tree.DropFunction)

Aggregations

DropFunction (io.crate.sql.tree.DropFunction)2 BeginStatement (io.crate.sql.tree.BeginStatement)1 CommitStatement (io.crate.sql.tree.CommitStatement)1 CopyFrom (io.crate.sql.tree.CopyFrom)1 CreateFunction (io.crate.sql.tree.CreateFunction)1 CreateTable (io.crate.sql.tree.CreateTable)1 CreateUser (io.crate.sql.tree.CreateUser)1 DeallocateStatement (io.crate.sql.tree.DeallocateStatement)1 DenyPrivilege (io.crate.sql.tree.DenyPrivilege)1 DropAnalyzer (io.crate.sql.tree.DropAnalyzer)1 DropBlobTable (io.crate.sql.tree.DropBlobTable)1 DropRepository (io.crate.sql.tree.DropRepository)1 DropSnapshot (io.crate.sql.tree.DropSnapshot)1 DropTable (io.crate.sql.tree.DropTable)1 DropUser (io.crate.sql.tree.DropUser)1 DropView (io.crate.sql.tree.DropView)1 FunctionArgument (io.crate.sql.tree.FunctionArgument)1 GCDanglingArtifacts (io.crate.sql.tree.GCDanglingArtifacts)1 GrantPrivilege (io.crate.sql.tree.GrantPrivilege)1 Insert (io.crate.sql.tree.Insert)1