Package com.foundationdb.ais.model

Examples of com.foundationdb.ais.model.AkibanInformationSchema


            }
        }
        if(parts[0].isEmpty()) {
            parts[0] = context.getCurrentSchema();
        }
        AkibanInformationSchema ais = context.getQueryContext().getStore().schema().ais();
        Table table = ais.getTable(parts[0], parts[1]);
        if(table == null) {
            throw new NoSuchTableException(parts[0], parts[1]);
        }
        Column column = table.getColumn(parts[2]);
        if(column == null) {
View Full Code Here


            return schema.tableRowType(aisTable);
        }

        protected IndexRowType getIndexRowType(SingleIndexScan index) {
            Index aisIndex = index.getIndex();
            AkibanInformationSchema ais = schema.ais();
            for (int i : aisIndex.getAllTableIDs()) {
                affectedTables.add(ais.getTable(i));
            }
            return schema.indexRowType(aisIndex);
        }
View Full Code Here

    // When the AIS changes, throw everything away, since it might
    // point to obsolete objects.
    protected void updateAIS(PostgresQueryContext context) {
        DDLFunctions ddl = reqs.dxl().ddlFunctions();
        AkibanInformationSchema newAIS = ddl.getAIS(session);
        if ((ais != null) && (ais.getGeneration() == newAIS.getGeneration()))
            return;             // Unchanged.
        ais = newAIS;
        rebuildCompiler();
    }
View Full Code Here

        }
    }

    protected void updateAIS(EmbeddedQueryContext context) {
        DDLFunctions ddl = reqs.dxl().ddlFunctions();
        AkibanInformationSchema newAIS = ddl.getAIS(session);
        if ((ais != null) && (ais.getGeneration() == newAIS.getGeneration()))
            return;             // Unchanged.
        ais = newAIS;
        rebuildCompiler();
    }
View Full Code Here

            createTable(SCHEMA_NAME, TABLE_NAME,
                        "id int not null primary key",
                        "u int",
                        "unique(u)");
        writeRows(row(tableId, 0, 0));
        AkibanInformationSchema ais = ddl().getAIS(session());
        Table table = ais.getTable(tableId);
        Index uIndex = null;
        for (TableIndex index : table.getIndexes()) {
            if (index.getKeyColumns().get(0).getColumn().getName().equals("u")) {
                uIndex = index;
            }
View Full Code Here

    }

    @Test
    public void multipleSchemasAndRestart() throws Exception {
        final int TABLE_COUNT = 3;
        AkibanInformationSchema ais = ais();
        final int UT_COUNT = ais.getTables().size();

        createTable(SCHEMA+"1", "t1", "id int not null primary key");
        createTable(SCHEMA+"2", "t2", "id int not null primary key");
        createTable(SCHEMA+"3", "t3", "id int not null primary key");

        ais = ais();
        assertEquals("user tables count", TABLE_COUNT + UT_COUNT, ais.getTables().size());
        assertTablesInSchema(SCHEMA+"1", "t1");
        assertTablesInSchema(SCHEMA+"2", "t2");
        assertTablesInSchema(SCHEMA+"3", "t3");

        safeRestart();
        ais = ais();
        assertNotNull("ais exists", ais);

        assertEquals("user tables count", TABLE_COUNT + UT_COUNT, ais.getTables().size());
        assertTablesInSchema(SCHEMA+"1", "t1");
        assertTablesInSchema(SCHEMA+"2", "t2");
        assertTablesInSchema(SCHEMA+"3", "t3");
    }
View Full Code Here

    @Test
    public void userAndSystemRoutines() {
        final TableName sysName = new TableName(TableName.SYS_SCHEMA, "sys");
        final TableName userName = new TableName(SCHEMA, "user");
        AkibanInformationSchema temp = new AkibanInformationSchema();
        final Routine sysR = Routine.create(temp, sysName.getSchemaName(), sysName.getTableName(), "other", Routine.CallingConvention.SQL_ROW);
        final Routine userR = Routine.create(temp, userName.getSchemaName(), userName.getTableName(), "java", Routine.CallingConvention.JAVA);

        schemaManager.registerSystemRoutine(sysR);
        assertNotNull("Found sys routine after register", ais().getRoutine(sysName));
View Full Code Here

    public void alterSequenceName() {
        transactionallyUnchecked(new Runnable()
        {
            @Override
            public void run() {
                AkibanInformationSchema ais = new AkibanInformationSchema();
                Sequence s1 = Sequence.create(ais, SCHEMA, "s1", 1, 1, 1, 10, false);
                schemaManager.createSequence(session(), s1);
            }
        });
        transactionallyUnchecked(new Runnable()
        {
            @Override
            public void run() {
                AkibanInformationSchema ais = new AkibanInformationSchema();
                Sequence s2 = Sequence.create(ais, SCHEMA, "s2", 1, 1, 1, 10, false);
                schemaManager.alterSequence(session(), new TableName(SCHEMA, "s1"), s2);
            }
        });
    }
View Full Code Here

        final TableName name = new TableName(SCHEMA, "s");
        transactionallyUnchecked(new Runnable()
        {
            @Override
            public void run() {
                AkibanInformationSchema ais = new AkibanInformationSchema();
                Sequence s = Sequence.create(ais, name.getSchemaName(), name.getTableName(), 3, 4, 1, 10, false);
                schemaManager.createSequence(session(), s);
            }
        });
        transactionallyUnchecked(new Runnable()
        {
            @Override
            public void run() {
                AkibanInformationSchema ais = new AkibanInformationSchema();
                Sequence s = Sequence.create(ais, name.getSchemaName(), name.getTableName(), 5, 6, 2, 20, true);
                schemaManager.alterSequence(session(), s.getSequenceName(), s);
            }
        });
        Sequence s = ais().getSequence(name);
View Full Code Here

        assertNotNull("identity sequence", origSequence);
        transactionallyUnchecked(new Runnable()
        {
            @Override
            public void run() {
                AkibanInformationSchema ais = new AkibanInformationSchema();
                Sequence s = Sequence.create(ais, name.getSchemaName(), name.getTableName(), 5, 6, 2, 20, true);
                schemaManager.alterSequence(session(), s.getSequenceName(), s);
            }
        });
View Full Code Here

TOP

Related Classes of com.foundationdb.ais.model.AkibanInformationSchema

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.