Package com.foundationdb.ais.model.aisb2

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


        final int identMax = 128;
        final int tableVersion = 1;
        final String schema = TableName.INFORMATION_SCHEMA;
        NewAISBuilder builder = AISBBasedBuilder.create(schema, schemaManager.getTypesTranslator());
        // TODO: Hidden PK too expensive?
        builder.table(CHANGES_TABLE)
               .colString("schema_name", identMax, false)
               .colString("table_name", identMax, false)
               .colString("index_name", identMax, false)
               .colInt("index_id", false)
               .colVarBinary("hkey", 4096, false);
View Full Code Here


        Table table = builder.ais().getTable(SCHEMA, "c");

        ddl().createTable(session(),  table);

        builder = AISBBasedBuilder.create(ddl().getTypesTranslator());
        builder.table(SCHEMA, "c").colInt("c1").colInt("c2").colInt("c3").pk("c1");
        table = builder.ais().getTable(SCHEMA, "c");

        ddl().alterTable(session(), table.getName(), table,
                         Arrays.asList(TableChange.createAdd("c2")), NO_CHANGES,
                         null);
View Full Code Here

    @Test
    public void addColumnIndexSingleTableNoPrimaryKey() throws StandardException {
        TableName cName = tableName(SCHEMA, "c");
        NewAISBuilder builder = AISBBasedBuilder.create(ddl().getTypesTranslator());
        builder.table(cName).colInt("c1", true).colInt("c2", true).colInt("c3", true);

        ddl().createTable(session(), builder.unvalidatedAIS().getTable(cName));

        // Note: Not using standard id due to null index contents
        int tableId = tableId(cName);
View Full Code Here

                row(tableId, 4, 5, 6),
                row(tableId, 7, 8, 9)
        );

        builder = AISBBasedBuilder.create(ddl().getTypesTranslator());
        builder.table(cName).colInt("c1", true).colInt("c2", true).colInt("c3", true).colInt("c4", true).key("c4", "c4");
        List<TableChange> changes = new ArrayList<>();
        changes.add(TableChange.createAdd("c4"));

        ddl().alterTable(session(), cName, builder.unvalidatedAIS().getTable(cName), changes, changes, queryContext());
View Full Code Here

    }

    @Test
    public void autoIncrementInsertTest() throws Exception {
        NewAISBuilder builder = AISBBasedBuilder.create("test", ddl().getTypesTranslator());
        builder.table("A").autoIncInt("I", 1).colString("V", 255).pk("I");
        ddl().createTable(session(), builder.ais().getTable("test", "A"));

        int tableId = tableId("test", "A");
        for (int i = 1; i <= ROW_COUNT; i++) {
            writeRows(row(tableId, i, "This is record # " + 1));
View Full Code Here

public class TableIDCollisionIT extends ITBase {
    private Table simpleISTable() {
        final TableName FAKE_TABLE = new TableName(TableName.INFORMATION_SCHEMA, "fake_table");
        NewAISBuilder builder = AISBBasedBuilder.create(ddl().getTypesTranslator());
        builder.table(FAKE_TABLE).colInt("id").pk("id");
        Table table = builder.ais().getTable(FAKE_TABLE);
        assertNotNull("Found table", table);
        return table;
    }
View Full Code Here

     * Really testing that table statuses get deleted, but about as direct as we can get from this level.
     */
    @Test
    public void dropThenCreateRowDefIDRecycled() throws InvalidOperationException {
        NewAISBuilder builder = AISBBasedBuilder.create("test", ddl().getTypesTranslator());
        builder.table("t1").autoIncInt("id", 1).pk("id").colString("name", 255);
        ddl().createTable(session(), builder.ais().getTable("test", "t1"));
        final int tidV1 = tableId("test", "t1");

        writeRow(tidV1, 1, "hello world");
        expectRowCount(tidV1, 1);
View Full Code Here


    @Test(expected=UndeclaredColumnChangeException.class)
    public void unspecifiedColumnChange() {
        NewAISBuilder builder = AISBBasedBuilder.create(ddl().getTypesTranslator());
        builder.table(SCHEMA, "c").colInt("c1").pk("c1");
        Table table = builder.ais().getTable(SCHEMA, "c");

        ddl().createTable(session(),  table);

        builder = AISBBasedBuilder.create(ddl().getTypesTranslator());
View Full Code Here

    @Test(expected=JoinToProtectedTableException.class)
    public void joinToISTable() throws Exception {
        TableName name = new TableName(TableName.INFORMATION_SCHEMA, "p");
        NewAISBuilder builder = AISBBasedBuilder.create(SCHEMA, schemaManager.getTypesTranslator());
        builder.table(name).colInt("id", false).pk("id");
        try {
            builder.table(T1_NAME).colInt("id", false).colInt("pid", true).pk("id").joinTo("information_schema", "p").on("pid", "id");
            registerISTable(builder.unvalidatedAIS().getTable(name), new MemoryTableFactoryMock());
            ddl().createTable(session(), builder.unvalidatedAIS().getTable(SCHEMA, T1_NAME));
        } finally {
View Full Code Here

    public void joinToISTable() throws Exception {
        TableName name = new TableName(TableName.INFORMATION_SCHEMA, "p");
        NewAISBuilder builder = AISBBasedBuilder.create(SCHEMA, schemaManager.getTypesTranslator());
        builder.table(name).colInt("id", false).pk("id");
        try {
            builder.table(T1_NAME).colInt("id", false).colInt("pid", true).pk("id").joinTo("information_schema", "p").on("pid", "id");
            registerISTable(builder.unvalidatedAIS().getTable(name), new MemoryTableFactoryMock());
            ddl().createTable(session(), builder.unvalidatedAIS().getTable(SCHEMA, T1_NAME));
        } finally {
            // ApiTestBase#tearDownAllTables skips IS tables
            unRegisterISTable(name);
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.