Package com.foundationdb.qp.rowtype

Examples of com.foundationdb.qp.rowtype.Schema


                row(iid, 200, 20, "d")
        );

        runAlter(ChangeLevel.GROUP, "ALTER TABLE i ADD GROUPING FOREIGN KEY(spare_id) REFERENCES o(id)");

        Schema schema = SchemaCache.globalSchema(ddl().getAIS(session()));
        RowType cType = schema.tableRowType(getTable(SCHEMA, "c"));
        RowType oType = schema.tableRowType(getTable(SCHEMA, "o"));
        RowType iType = schema.tableRowType(getTable(SCHEMA, "i"));

        StoreAdapter adapter = newStoreAdapter(schema);
        compareRows(
                new Row[] {
                        // null c
View Full Code Here


                row(oid, 60, 6, "c")
        );

        runAlter(ChangeLevel.GROUP, "ALTER TABLE o DROP GROUPING FOREIGN KEY");

        Schema schema = SchemaCache.globalSchema(ddl().getAIS(session()));
        RowType cType = schema.tableRowType(getTable(SCHEMA, "c"));
        RowType oType = schema.tableRowType(getTable(SCHEMA, "o"));

        StoreAdapter adapter = newStoreAdapter(schema);
        compareRows(
                new Row[] {
                        testRow(cType, 1L, "asdf"),
View Full Code Here

                row(iid, 200, 20, "d")
        );

        runAlter(ChangeLevel.GROUP, "ALTER TABLE o ADD GROUPING FOREIGN KEY(cid) REFERENCES c(id)");

        Schema schema = SchemaCache.globalSchema(ddl().getAIS(session()));
        RowType cType = schema.tableRowType(getTable(SCHEMA, "c"));
        RowType oType = schema.tableRowType(getTable(SCHEMA, "o"));
        RowType iType = schema.tableRowType(getTable(SCHEMA, "i"));

        StoreAdapter adapter = newStoreAdapter(schema);
        compareRows(
                new Row[] {
                        // ?
View Full Code Here

                row(iid, 200, 20, "d")
        );

        runAlter(ChangeLevel.GROUP, "ALTER TABLE o DROP GROUPING FOREIGN KEY");

        Schema schema = SchemaCache.globalSchema(ddl().getAIS(session()));
        RowType cType = schema.tableRowType(getTable(SCHEMA, "c"));
        RowType oType = schema.tableRowType(getTable(SCHEMA, "o"));
        RowType iType = schema.tableRowType(getTable(SCHEMA, "i"));

        StoreAdapter adapter = newStoreAdapter(schema);
        compareRows(
                new Row[] {
                        testRow(cType, 1, "asdf"),
View Full Code Here

        runAlter(ChangeLevel.GROUP, "ALTER TABLE o ADD GROUPING FOREIGN KEY(cid) REFERENCES c(id)");

        // Check for a hidden PK generator in a bad state (e.g. reproducing old values)
        writeRows(row(oid, "dd", 4L));

        Schema schema = SchemaCache.globalSchema(ddl().getAIS(session()));
        RowType cType = schema.tableRowType(getTable(SCHEMA, C_TABLE));
        RowType oType = schema.tableRowType(getTable(SCHEMA, O_TABLE));
        StoreAdapter adapter = newStoreAdapter(schema);
        compareRows(
                new Row[] {
                        testRow(cType, 1L, "a"),
                            testRow(oType, "aa", 1L, 1L),
View Full Code Here

        runAlter(ChangeLevel.TABLE, "ALTER TABLE c ADD COLUMN n INT DEFAULT 0");

        writeRows(row(cid, "e", 3));

        Schema schema = SchemaCache.globalSchema(ddl().getAIS(session()));
        TableRowType cType = schema.tableRowType(getTable(SCHEMA, C_TABLE));
        StoreAdapter adapter = newStoreAdapter(schema);
        long pk = 1L;
        compareRows(
                new Row[]{
                        testRow(cType, "a", 0, pk++),
View Full Code Here

        runAlter(ChangeLevel.GROUP, "ALTER TABLE c DROP COLUMN n");

        writeRows(row(cid, "e"));

        Schema schema = SchemaCache.globalSchema(ddl().getAIS(session()));
        TableRowType cType = schema.tableRowType(getTable(SCHEMA, C_TABLE));
        StoreAdapter adapter = newStoreAdapter(schema);
        long pk = 1L;
        compareRows(
                new Row[]{
                        testRow(cType, "a", pk++),
View Full Code Here

    protected static Row testRow(RowType type, Object... fields) {
        return new TestRow(type, fields);
    }

    protected void compareRows(Object[][] expected, Table table) {
        Schema schema = SchemaCache.globalSchema(ais());
        TableRowType rowType = schema.tableRowType(table);
        Row[] rows = new Row[expected.length];
        for (int i = 0; i < expected.length; i++) {
            rows[i] = new TestRow(rowType, expected[i]);
        }
       
View Full Code Here

                        queryContext.createBindings())
            );
    }
   
    protected void compareRows(Object[][] expected, Index index) {
        Schema schema = SchemaCache.globalSchema(ais());
        IndexRowType rowType = schema.indexRowType(index);
        Row[] rows = new Row[expected.length];
        for(int i = 0; i < expected.length; ++i) {
            rows[i] = new TestRow(rowType, expected[i]);
        }
        StoreAdapter adapter = newStoreAdapter(schema);
View Full Code Here

                            "pid int",
                            "parent_instance int",
                            "primary key(cid)",
                            String.format("grouping foreign key(pid, parent_instance) references %s(pid, parent_instance)",
                                          parentTableName));
        schema = new Schema(ais());
        parentRowType = schema.tableRowType(table(parent));
        childRowType = schema.tableRowType(table(child));
        parentPKIndexType = indexType(parent, "pid", "parent_instance");
        group = group(parent);
        adapter = newStoreAdapter(schema);
View Full Code Here

TOP

Related Classes of com.foundationdb.qp.rowtype.Schema

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.