Package com.foundationdb.sql.parser

Examples of com.foundationdb.sql.parser.ExplainStatementNode


    @Override
    public PostgresStatement finishGenerating(PostgresServerSession server, String sql, StatementNode stmt,
                                              List<ParameterNode> params, int[] paramTypes) {
        this.schema = compiler.getSchema();
        ExplainPlanContext context = new ExplainPlanContext(compiler, new PostgresQueryContext(server, this.schema));
        ExplainStatementNode explainStmt = (ExplainStatementNode)stmt;
        StatementNode innerStmt = explainStmt.getStatement();
        if (params == null)
            params = new ParameterFinder().find(innerStmt);
        Explainable explainable;
        if (innerStmt instanceof CallStatementNode) {
            explainable = PostgresCallStatementGenerator.explainable(server, (CallStatementNode)innerStmt, params, paramTypes);
        }
        else {
            BasePlannable result = compiler.compile((DMLStatementNode)innerStmt, params, context);
            explainable = result.getPlannable();
        }
        List<String> explain;
        if (compiler instanceof PostgresJsonCompiler) {
            JsonFormatter f = new JsonFormatter();
            explain = Collections.singletonList(f.format(explainable.getExplainer(context.getExplainContext())));
        }
        else {
            DefaultFormatter.LevelOfDetail detail;
            switch (explainStmt.getDetail()) {
            case BRIEF:
                detail = DefaultFormatter.LevelOfDetail.BRIEF;
                break;
            default:
            case NORMAL:
View Full Code Here

TOP

Related Classes of com.foundationdb.sql.parser.ExplainStatementNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.