Package com.foundationdb.sql.parser

Examples of com.foundationdb.sql.parser.StatementNode


    @Test
    public void createTableAs4() throws Exception {
        makeSeparateAIS();
        String sql = "CREATE TABLE t1 AS (SELECT * FROM t2) WITH  NO DATA";
        createTableAsCGenerateAIS();
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue (stmt instanceof CreateTableNode);
        List<String> columnNames = Arrays.asList("c1", "c2", "c3");
        DataTypeDescriptor d = new DataTypeDescriptor(TypeId.INTEGER_ID, false);
        List<DataTypeDescriptor> descriptors = Arrays.asList(d,d,d);
        TableDDL.createTable(ddlFunctions, null, DEFAULT_SCHEMA, (CreateTableNode)stmt, null, descriptors ,columnNames, null);
View Full Code Here


    @Test
    public void createTableAs5() throws Exception {
        makeSeparateAIS();
        String sql = "CREATE TABLE t1 (c1, c2) AS (SELECT column1, column2, column3 FROM t2) WITH NO DATA";
        createTableAsMixGenerateAIS();
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue (stmt instanceof CreateTableNode);
        List<String> columnNames = Arrays.asList("column1", "column2", "column3");
        DataTypeDescriptor d = new DataTypeDescriptor(TypeId.INTEGER_ID, false);
        List<DataTypeDescriptor> descriptors = Arrays.asList(d,d,d);
        TableDDL.createTable(ddlFunctions, null, DEFAULT_SCHEMA, (CreateTableNode)stmt, null, descriptors ,columnNames, null);
View Full Code Here

    @Test (expected=InvalidCreateAsException.class)
    public void createTableAs6() throws Exception {
        makeSeparateAIS();
        String sql = "CREATE TABLE t1 (c1, c2, c3) AS (SELECT column1, column2 FROM t2) WITH NO DATA";
        createTableAsMixGenerateAIS();
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue (stmt instanceof CreateTableNode);
        List<String> columnNames = Arrays.asList("column1", "column2");
        DataTypeDescriptor d = new DataTypeDescriptor(TypeId.INTEGER_ID, false);
        List<DataTypeDescriptor> descriptors = Arrays.asList(d,d);
        TableDDL.createTable(ddlFunctions, null, DEFAULT_SCHEMA, (CreateTableNode)stmt, null, descriptors ,columnNames, null);
View Full Code Here

        builder.basicSchemaIsComplete();
        builder.groupingIsComplete();

        String sql = String.format("CREATE TABLE t1 (c1 INT DEFAULT %s, c2 VARCHAR(32) DEFAULT '%s')",
                                   DEFAULT_C1, DEFAULT_C2);
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue (stmt instanceof CreateTableNode);
        TableDDL.createTable(ddlFunctions, null, DEFAULT_SCHEMA, (CreateTableNode)stmt, null);
    }
View Full Code Here

        builder.columnAsIdentity(DEFAULT_SCHEMA, DEFAULT_TABLE, "c1", "sequence_c1", true);
        builder.basicSchemaIsComplete();
        builder.groupingIsComplete();

        String sql = "CREATE TABLE t1 (c1 INT GENERATED BY DEFAULT AS IDENTITY)";
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue (stmt instanceof CreateTableNode);
        TableDDL.createTable(ddlFunctions, null, DEFAULT_SCHEMA, (CreateTableNode)stmt, null);
    }
View Full Code Here

        builder.columnAsIdentity(DEFAULT_SCHEMA, DEFAULT_TABLE, "c1", "sequence_c1", false);
        builder.basicSchemaIsComplete();
        builder.groupingIsComplete();

        String sql = "CREATE TABLE t1 (c1 INT GENERATED ALWAYS AS IDENTITY)";
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue (stmt instanceof CreateTableNode);
        TableDDL.createTable(ddlFunctions, null, DEFAULT_SCHEMA, (CreateTableNode)stmt, null);
    }
View Full Code Here

        builder.columnAsIdentity(DEFAULT_SCHEMA, DEFAULT_TABLE, "c1", "sequence_c1", true);
        builder.basicSchemaIsComplete();
        builder.groupingIsComplete();

        String sql = "Create Table " + DEFAULT_TABLE + " (c1 SERIAL)";
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue (stmt instanceof CreateTableNode);
        TableDDL.createTable(ddlFunctions, null, DEFAULT_SCHEMA, (CreateTableNode)stmt, null);
    }
View Full Code Here

        builder.columnAsIdentity(DEFAULT_SCHEMA, DEFAULT_TABLE, "c1", "sequence_c1", true);
        builder.basicSchemaIsComplete();
        builder.groupingIsComplete();

        String sql = "Create Table " + DEFAULT_TABLE + " (c1 BIGSERIAL)";
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue (stmt instanceof CreateTableNode);
        TableDDL.createTable(ddlFunctions, null, DEFAULT_SCHEMA, (CreateTableNode)stmt, null);
    }
View Full Code Here

   
    //bug1047037
    @Test (expected=DuplicateIndexException.class)
    public void namedPKConstraint() throws StandardException {
        String sql = "CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, CONSTRAINT co1 PRIMARY KEY (c1))";
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue(stmt instanceof CreateTableNode);
        TableDDL.createTable(ddlFunctions, null, DEFAULT_SCHEMA, (CreateTableNode)stmt, null);
    }
View Full Code Here

        builder.pk(DEFAULT_SCHEMA, DEFAULT_TABLE);
        builder.indexColumn(DEFAULT_SCHEMA, DEFAULT_TABLE, "PRIMARY", "c1", 0, true, 0);

        builder.basicSchemaIsComplete();
        builder.groupingIsComplete();
        StatementNode stmt = parser.parseStatement(sql);
        assertTrue(stmt instanceof CreateTableNode);
        TableDDL.createTable(ddlFunctions, null, DEFAULT_SCHEMA, (CreateTableNode)stmt, null);
    }
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.