Package com.foundationdb.sql.parser

Examples of com.foundationdb.sql.parser.StatementNode


    public void createSchemaEmpty () throws Exception
    {
        String sql = "CREATE SCHEMA EMPTY";
        AkibanInformationSchema ais = new AkibanInformationSchema();
       
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue (stmt instanceof CreateSchemaNode);
       
        SchemaDDL.createSchema(ais, null, (CreateSchemaNode)stmt, null);
    }
View Full Code Here


        String sql = "CREATE SCHEMA S";
        AkibanInformationSchema ais = factory();
       
        assertNotNull(ais.getTable("s", "t"));
       
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue (stmt instanceof CreateSchemaNode);
       
        SchemaDDL.createSchema(ais, null, (CreateSchemaNode)stmt, null);
    }
View Full Code Here

        String sql = "CREATE SCHEMA IF NOT EXISTS SS";
        AkibanInformationSchema ais = factory();
       
        assertNotNull(ais.getTable("s", "t"));
       
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue (stmt instanceof CreateSchemaNode);
       
        SchemaDDL.createSchema(ais, null, (CreateSchemaNode)stmt, null);
    }
View Full Code Here

        String sql = "CREATE SCHEMA IF NOT EXISTS S";
        AkibanInformationSchema ais = factory();
       
        assertNotNull(ais.getTable("s", "t"));
       
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue (stmt instanceof CreateSchemaNode);
       
        SchemaDDL.createSchema(ais, null, (CreateSchemaNode)stmt, null);
    }
View Full Code Here

    public void dropSchemaEmpty() throws Exception
    {
        String sql = "DROP SCHEMA EMPTY RESTRICT";
        AkibanInformationSchema ais = new AkibanInformationSchema();
       
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue (stmt instanceof DropSchemaNode);
       
        DDLFunctions ddlFunctions = new TableDDLTest.DDLFunctionsMock(ais);
       
        SchemaDDL.dropSchema(ddlFunctions, null, (DropSchemaNode)stmt, null);
View Full Code Here

    public void dropNonExistingSchemaWithIfExists() throws Exception
    {
        String sql = "DROP SCHEMA IF EXISTS AA";
        AkibanInformationSchema ais = new AkibanInformationSchema();
       
        StatementNode node = parser.parseStatement(sql);
        assertTrue(node instanceof DropSchemaNode);
       
        DDLFunctions ddlFunctions = new TableDDLTest.DDLFunctionsMock(ais);
       
        SchemaDDL.dropSchema(ddlFunctions, null, (DropSchemaNode)node, null);
View Full Code Here

    public void dropSchemaEmptyIfExists() throws Exception
    {
        String sql = "DROP SCHEMA IF EXISTS EMPTY RESTRICT";
        AkibanInformationSchema ais = new AkibanInformationSchema();
       
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue (stmt instanceof DropSchemaNode);
       
        DDLFunctions ddlFunctions = new TableDDLTest.DDLFunctionsMock(ais);
       
        SchemaDDL.dropSchema(ddlFunctions, null, (DropSchemaNode)stmt, null);
View Full Code Here

        String sql = "DROP SCHEMA S RESTRICT";
        AkibanInformationSchema ais = factory();
       
        assertNotNull(ais.getTable("s", "t"));
       
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue (stmt instanceof DropSchemaNode);
        DDLFunctions ddlFunctions = new TableDDLTest.DDLFunctionsMock(ais);
       
        SchemaDDL.dropSchema(ddlFunctions, null, (DropSchemaNode)stmt, null);
    }
View Full Code Here

        generateAndCheckResult();
    }

    @Override
    public String generateResult() throws Exception {
        StatementNode stmt = parser.parseStatement(sql);
        ExplainPlanContext context = new ExplainPlanContext(compiler, new SimpleQueryContext(null));
        BasePlannable result = compiler.compile((DMLStatementNode)stmt,
                                                parser.getParameterList(), context);
        return result.explainToString(context.getExplainContext(), OptimizerTestBase.DEFAULT_SCHEMA, DefaultFormatter.LevelOfDetail.VERBOSE_WITHOUT_COST);
    }
View Full Code Here

        this.typesTranslator = typesTranslator;
    }

    protected DataTypeDescriptor parseType(String typeString) throws Exception {
        String sql = String.format("SELECT CAST(x AS %s)", typeString);
        StatementNode stmt = new SQLParser().parseStatement(sql);
        return ((DMLStatementNode)stmt).getResultSetNode().getResultColumns()
            .get(0).getExpression().getType();
    }
View Full Code Here

TOP

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

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.