Package com.foundationdb.ais.model.aisb2

Examples of com.foundationdb.ais.model.aisb2.NewAISBuilder.unvalidatedAIS()


        builder.sequence(sequenceName.getTableName());
        builder.table("customers").
            colBigInt("customer_id", false).
            colString("customer_name", 100, false).
            pk("customer_id");
        AkibanInformationSchema inAIS = builder.unvalidatedAIS();
        Column idColumn = inAIS.getTable(new TableName (SCHEMA, "customers")).getColumn(0);
        idColumn.setDefaultIdentity(true);
        idColumn.setIdentityGenerator(inAIS.getSequence(sequenceName));
       
        AkibanInformationSchema outAIS = writeAndRead(builder.ais());
View Full Code Here


    @Test
    public void maxStorageSizeAndPrefixSize() {
        final String TABLE = "t";
        NewAISBuilder builder = AISBBasedBuilder.create(SCHEMA, typesTranslator());
        builder.table(TABLE).colBigInt("id");
        AkibanInformationSchema inAIS = builder.unvalidatedAIS();

        // Note: If storage* methods go away, or are non-null by default, that is *good* and these can go away
        Column inCol = inAIS.getTable(SCHEMA, TABLE).getColumn(0);
        assertNull("storedMaxStorageSize null by default", inCol.getMaxStorageSizeWithoutComputing());
        assertNull("storedPrefixSize null by default", inCol.getPrefixSizeWithoutComputing());
View Full Code Here

    public void columnDefaultValue() {
        final String TABLE = "t";
        NewAISBuilder builder = AISBBasedBuilder.create(SCHEMA, typesTranslator());
        builder.table(TABLE).colBigInt("id");

        AkibanInformationSchema inAIS = builder.unvalidatedAIS();
        Column inCol = inAIS.getTable(SCHEMA, TABLE).getColumn("id");

        AkibanInformationSchema outAIS = writeAndRead(inAIS);
        Column outCol = outAIS.getTable(SCHEMA, TABLE).getColumn("id");
        assertEquals("default defaultValue null", inCol.getDefaultValue(), outCol.getDefaultValue());
View Full Code Here

        NewAISBuilder builder2 = AISBBasedBuilder.create(typesTranslator);
        builder2.table(cName).colBigInt("id", false).pk("id")
                .table(oName).colBigInt("id", false).colBigInt("cid", true).joinTo(SCHEMA, "c", "fk1").on("cid", "id")
                .table(iName).colBigInt("id", false).colBigInt("oid", true).pk("id").joinTo(SCHEMA, "o", "fk2").on("oid", "id");
        Table t1 = builder1.unvalidatedAIS().getTable(oName);
        Table t2 = builder2.unvalidatedAIS().getTable(oName);
        validate(
                t1, t2,
                asList(TableChange.createAdd(Column.ROW_ID_NAME)),
                AUTO_CHANGES,
                ChangeLevel.GROUP,
View Full Code Here

    public void dropColumnInGroupIndex() {
        NewAISBuilder builder = AISBBasedBuilder.create(SCHEMA, typesTranslator);
        builder.table("p").colInt("id").colInt("x").pk("id")
               .table(TABLE).colInt("id").colInt("pid").colInt("y").pk("id").joinTo(SCHEMA, "p", "fk").on("pid", "id")
               .groupIndex("x_y", Index.JoinType.LEFT).on(TABLE, "y").and("p", "x");
        Table t1 = builder.unvalidatedAIS().getTable(TABLE_NAME);
        builder = AISBBasedBuilder.create(SCHEMA, typesTranslator);
        builder.table("p").colInt("id").colInt("x").pk("id")
               .table(TABLE).colInt("id").colInt("pid").pk("id").joinTo(SCHEMA, "p", "fk").on("pid", "id");
        Table t2 = builder.unvalidatedAIS().getTable(TABLE_NAME);
        final String KEY1 = Index.PRIMARY;
View Full Code Here

               .groupIndex("x_y", Index.JoinType.LEFT).on(TABLE, "y").and("p", "x");
        Table t1 = builder.unvalidatedAIS().getTable(TABLE_NAME);
        builder = AISBBasedBuilder.create(SCHEMA, typesTranslator);
        builder.table("p").colInt("id").colInt("x").pk("id")
               .table(TABLE).colInt("id").colInt("pid").pk("id").joinTo(SCHEMA, "p", "fk").on("pid", "id");
        Table t2 = builder.unvalidatedAIS().getTable(TABLE_NAME);
        final String KEY1 = Index.PRIMARY;
        final String KEY2 = "fk";
        validate(
                t1, t2,
                asList(TableChange.createDrop("y")),
View Full Code Here

        builder.table("p").colInt("id").colInt("x").pk("id")
               .table(TABLE).colInt("id").colInt("pid").colInt("y").pk("id").joinTo(SCHEMA, "p", "fk1").on("pid", "id")
               .table(iName).colInt("id").colInt("tid").colInt("z").pk("id").joinTo(SCHEMA, TABLE, "fk2").on("tid", "id")
               .groupIndex("x_y", Index.JoinType.LEFT).on(TABLE, "y").and("p", "x")                  // spans 2
               .groupIndex("x_y_z", Index.JoinType.LEFT).on("i", "z").and(TABLE, "y").and("p", "x"); // spans 3
        Table t1 = builder.unvalidatedAIS().getTable(TABLE_NAME);
        builder = AISBBasedBuilder.create(SCHEMA, typesTranslator);
        builder.table("p").colInt("id").colInt("x").pk("id")
                .table(TABLE).colInt("id").colInt("pid").colInt("y").pk("id").key("fk1", "pid")
                .table(iName).colInt("id").colInt("tid").colInt("z").pk("id").joinTo(SCHEMA, TABLE, "fk2").on("tid", "id");
        Table t2 = builder.unvalidatedAIS().getTable(TABLE_NAME);
View Full Code Here

        Table t1 = builder.unvalidatedAIS().getTable(TABLE_NAME);
        builder = AISBBasedBuilder.create(SCHEMA, typesTranslator);
        builder.table("p").colInt("id").colInt("x").pk("id")
                .table(TABLE).colInt("id").colInt("pid").colInt("y").pk("id").key("fk1", "pid")
                .table(iName).colInt("id").colInt("tid").colInt("z").pk("id").joinTo(SCHEMA, TABLE, "fk2").on("tid", "id");
        Table t2 = builder.unvalidatedAIS().getTable(TABLE_NAME);
        validate(
                t1, t2,
                NO_CHANGES,
                NO_CHANGES,
                ChangeLevel.GROUP,
View Full Code Here

    private void fkTest(boolean isAdd) {
        TableName PARENT = new TableName(SCHEMA, "p");
        Table t1 = table(builder(PARENT).colBigInt("pid").pk("pid").table(TABLE).colBigInt("cid").colBigInt("pid").pk("cid"), TABLE_NAME);
        NewAISBuilder builder = builder(PARENT).colBigInt("pid").pk("pid").table(TABLE).colBigInt("cid").colBigInt("pid").pk("cid");
        AkibanInformationSchema ais = builder.unvalidatedAIS();
        Table t2 = ais.getTable(TABLE_NAME);
        Table p2 = ais.getTable(PARENT);
        ForeignKey.create(ais, "__fk_1", t2, asList(t2.getColumn("pid")), p2, asList(p2.getColumn("pid")), Action.RESTRICT, Action.RESTRICT, false, false);
        Table pre = isAdd ? t1 : t2;
        Table post = isAdd ? t2 : t1;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.