Package com.foundationdb.sql.parser

Examples of com.foundationdb.sql.parser.SQLParser


    protected SQLParser parser;
    protected String[] featureLines;

    @Before
    public void before() throws Exception {
        parser = new SQLParser();
        if (featureLines != null)
            parseFeatures(featureLines, parser.getFeatures());
    }
View Full Code Here


    protected NodeToString unparser;
    protected String[] featureLines;

    @Before
    public void before() throws Exception {
        parser = new SQLParser();
        unparser = new NodeToString();
        if (featureLines != null)
            parseFeatures(featureLines, parser.getFeatures());
    }
View Full Code Here

    protected SQLParser parser;
    protected NodeToString unparser;

    @Before
    public void before() throws Exception {
        parser = new SQLParser();
        unparser = new NodeToString();
    }
View Full Code Here

    protected SQLParser parser;
    protected NodeToString unparser;

    @Before
    public void makeTransformers() throws Exception {
        parser = new SQLParser();
        unparser = new NodeToString();
    }
View Full Code Here

                                         null, null, columnName);
        }
    }

    protected void runAlter(String schema, QueryContext queryContext, String sql) {
        SQLParser parser = new SQLParser();
        StatementNode node;
        try {
            node = parser.parseStatement(sql);
        } catch(StandardException e) {
            throw new RuntimeException(e);
        }
        org.junit.Assert.assertTrue("is alter node", node instanceof AlterTableNode);
        AlterTableDDL.alterTable(ddl(), dml(), session(), schema, (AlterTableNode) node, queryContext);
View Full Code Here

        runAlter(session(), ddlForAlter(), dml(), null, expectedChangeLevel, defaultSchema, sql);
    }

    protected static void runAlter(Session session, DDLFunctions ddl, DMLFunctions dml, QueryContext context,
                                   TableChangeValidator.ChangeLevel expectedChangeLevel, String defaultSchema, String sql) {
        SQLParser parser = new SQLParser();
        StatementNode node;
        try {
            node = parser.parseStatement(sql);
        } catch(StandardException e) {
            throw new RuntimeException(e);
        }
        assertTrue("is alter node", node instanceof AlterTableNode);
        TableChangeValidator.ChangeLevel level = AlterTableDDL.alterTable(ddl, dml, session, defaultSchema, (AlterTableNode) node, context);
View Full Code Here

    }

    private List<TableName> getTableNames(Session session, ServerSession server, String queryExpression, Table table ){

        AkibanInformationSchema ais = schemaManager().getAis(session);
        SQLParser parser = server.getParser();
        StatementNode stmt;
        try {
            stmt = parser.parseStatement(queryExpression);
        } catch (StandardException e) {
            throw new SQLParserInternalException(e);
        }
        StoreAdapter adapter = store().createAdapter(session, SchemaCache.globalSchema(ais));
        CreateAsCompiler compiler = new CreateAsCompiler(server, adapter, false, ais);
View Full Code Here

        return parser;
    }
   
    protected Set<SQLParserFeature> initParser() {
        Set<SQLParserFeature> parserFeatures = getParserFeatures();
        parser = new SQLParser();
        parser.getFeatures().clear();
        parser.getFeatures().addAll(parserFeatures);

        defaultSchemaName = getProperty("database");
        if (defaultSchemaName == null)
View Full Code Here

        updateAIS(context);
        boolean localTransaction = false;
        sessionMonitor.enterStage(MonitorStage.PARSE);
        try {
            StatementNode sqlStmt;
            SQLParser parser = getParser();
            try {
                sqlStmt = parser.parseStatement(sql);
            }
            catch (SQLParserException ex) {
                throw new SQLParseException(ex);
            }
            catch (StandardException ex) {
                throw new SQLParserInternalException(ex);
            }
            sessionMonitor.enterStage(MonitorStage.OPTIMIZE);
            if (transaction == null) {
                transaction = new ServerTransaction(this, true, ServerTransaction.PeriodicallyCommit.OFF);
                localTransaction = true;
            }
            if ((sqlStmt instanceof DMLStatementNode) &&
                !(sqlStmt instanceof CallStatementNode))
                return compiler.compileExecutableStatement((DMLStatementNode)sqlStmt, parser.getParameterList(), getParameterNames, autoGeneratedKeys, context);
            if (autoGeneratedKeys != null)
                throw new UnsupportedOperationException();
            if (sqlStmt instanceof DDLStatementNode)
                return new ExecutableDDLStatement((DDLStatementNode)sqlStmt, sql);
            if (sqlStmt instanceof CallStatementNode)
                return ExecutableCallStatement.executableStatement((CallStatementNode)sqlStmt, parser.getParameterList(), context);
            throw new UnsupportedSQLException("Statement not recognized", sqlStmt);
        }
        finally {
            sessionMonitor.leaveStage();
            if (localTransaction)
View Full Code Here

        updateAIS(new EmbeddedQueryContext(this));
        boolean localTransaction = false;
        sessionMonitor.enterStage(MonitorStage.PARSE);
        try {
            StatementNode sqlStmt;
            SQLParser parser = getParser();
            try {
                sqlStmt = parser.parseStatement(sql);
            }
            catch (SQLParserException ex) {
                throw new SQLParseException(ex);
            }
            catch (StandardException ex) {
                throw new SQLParserInternalException(ex);
            }
            sessionMonitor.enterStage(MonitorStage.OPTIMIZE);
            if (transaction == null) {
                transaction = new ServerTransaction(this, true, ServerTransaction.PeriodicallyCommit.OFF);
                localTransaction = true;
            }
            ExplainPlanContext context = new ExplainPlanContext(compiler, new EmbeddedQueryContext(this));
            Explainable explainable;
            if ((sqlStmt instanceof DMLStatementNode) &&
                !(sqlStmt instanceof CallStatementNode))
                explainable = compiler.compile((DMLStatementNode)sqlStmt, parser.getParameterList(), context).getPlannable();
            else
                throw new UnsupportedSQLException("Statement not supported for EXPLAIN", sqlStmt);
            return explainable.getExplainer(context.getExplainContext());
        }
        finally {
View Full Code Here

TOP

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

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.