Package com.foundationdb.ais.model

Examples of com.foundationdb.ais.model.TableIndex


    @Test
    public void alterToCompatible() {
        createAndLoadTable();
        final int tid = tableId(SCHEMA, TABLE);
        TableIndex indexBefore = getTable(tid).getIndex(INDEX_NAME);
        assertEquals("index row count before alter", ROW_COUNT, scanAllIndex(indexBefore).size());
        runAlter("ALTER TABLE t1 ALTER c2 SET DATA TYPE decimal(22,14)");
        assertEquals("row count", ROW_COUNT, scanAll(tid).size());
        TableIndex index = getTable(tid).getIndex(INDEX_NAME);
        assertEquals("Index exists", true, index != null);
        assertEquals("index row count", ROW_COUNT, scanAllIndex(index).size());
    }
View Full Code Here


                                String... refColumns) {
        final Table newTable = ais.getTable(tableId);
        assertNotNull(newTable);
        final Table curTable = getTable(tableId);
       
        final TableIndex index = TableIndex.create(ais, newTable, indexName, 0, isUnique, false, isUnique ? new TableName(curTable.getName().getSchemaName(), "ukey") : null);

        int pos = 0;
        for (String colName : refColumns) {
            Column col = curTable.getColumn(colName);
            Column refCol = Column.create(newTable, col.getName(), col.getPosition(), col.getType());
View Full Code Here

        for(IndexChange ic : changeSet.getIndexChangeList()) {
            if(IndexType.TABLE.name().equals(ic.getIndexType())) {
                switch(ChangeType.valueOf(ic.getChange().getChangeType())) {
                    case ADD:
                    case MODIFY:
                        TableIndex index = newTable.getIndexIncludingInternal(ic.getChange().getNewName());
                        assert (index != null) : newTable.toString() + "," + ic;
                        tableIndexes.add(index);
                        break;
                }
            }
View Full Code Here

    public void createSpatialIndex() throws Exception {
        String sql = "CREATE TABLE test.t16 (c1 decimal(11,7), c2 decimal(11,7))";
        executeDDL(sql);
        sql = "CREATE INDEX t16_space on test.t16(z_order_lat_lon(c1, c2))";
        executeDDL(sql);
        TableIndex index = ais().getTable("test", "t16").getIndex("t16_space");
        assertNotNull(index);
        assertTrue(index.isSpatial());
       
    }
View Full Code Here

    @Test
    public void createSpatialIndexTable() throws Exception {
        String sql = "CREATE TABLE test.t16 (c1 decimal(11,7), c2 decimal(11,7), INDEX idx1 (z_order_lat_lon(c1, c2)))";
        executeDDL (sql);
        Table table = ais().getTable("test", "t16");
        TableIndex index = table.getIndex("idx1");
        assertNotNull(index);
        assertFalse (index.isUnique());
        assertEquals(2, index.getKeyColumns().size());
        assertTrue (index.isSpatial());
    }
View Full Code Here

TOP

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

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.