Search in sources :

Example 26 with Database

use of org.voltdb.catalog.Database in project voltdb by VoltDB.

the class SwapTablesPlanNode method viewsDependOn.

/**
     * @param theTable
     * @return
     */
private static boolean viewsDependOn(Table aTable, StringBuilder viewNames) {
    String separator = "(";
    for (MaterializedViewInfo anyView : aTable.getViews()) {
        viewNames.append(separator).append(anyView.getTypeName());
        separator = ", ";
    }
    for (Table anyTable : ((Database) aTable.getParent()).getTables()) {
        for (MaterializedViewHandlerInfo anyView : anyTable.getMvhandlerinfo()) {
            if (anyView.getSourcetables().getIgnoreCase(aTable.getTypeName()) != null) {
                viewNames.append(separator).append(anyView.getDesttable().getTypeName());
                separator = ", ";
            }
        }
    }
    if (", ".equals(separator)) {
        viewNames.append(")");
        return true;
    }
    return false;
}
Also used : MaterializedViewInfo(org.voltdb.catalog.MaterializedViewInfo) Table(org.voltdb.catalog.Table) Database(org.voltdb.catalog.Database) MaterializedViewHandlerInfo(org.voltdb.catalog.MaterializedViewHandlerInfo)

Example 27 with Database

use of org.voltdb.catalog.Database in project voltdb by VoltDB.

the class TestVoltCompilerAlterDropTable method verifyTableColumnGone.

//Check given col does not exists
private void verifyTableColumnGone(VoltCompiler compiler, String tableName, String colName) {
    Database db = compiler.m_catalog.getClusters().get("cluster").getDatabases().get("database");
    Table table = db.getTables().get(tableName);
    Column col = table.getColumns().get(colName);
    assertNull(col);
}
Also used : Table(org.voltdb.catalog.Table) Column(org.voltdb.catalog.Column) Database(org.voltdb.catalog.Database)

Example 28 with Database

use of org.voltdb.catalog.Database in project voltdb by VoltDB.

the class TestVoltCompilerAlterDropTable method verifyTableExists.

//Check given table exists
private void verifyTableExists(VoltCompiler compiler, String tableName) {
    Database db = compiler.m_catalog.getClusters().get("cluster").getDatabases().get("database");
    Table table = db.getTables().get(tableName);
    assertNotNull(table);
}
Also used : Table(org.voltdb.catalog.Table) Database(org.voltdb.catalog.Database)

Example 29 with Database

use of org.voltdb.catalog.Database in project voltdb by VoltDB.

the class TestVoltCompilerAlterDropTable method verifyTableColumnNullable.

//Check given col nullability if catalog was compiled.
private void verifyTableColumnNullable(VoltCompiler compiler, String tableName, String colName, boolean shouldBeNullable) {
    Database db = compiler.m_catalog.getClusters().get("cluster").getDatabases().get("database");
    Table table = db.getTables().get(tableName);
    Column col = table.getColumns().get(colName);
    assertNotNull(col);
    assertEquals(shouldBeNullable, col.getNullable());
}
Also used : Table(org.voltdb.catalog.Table) Column(org.voltdb.catalog.Column) Database(org.voltdb.catalog.Database)

Example 30 with Database

use of org.voltdb.catalog.Database in project voltdb by VoltDB.

the class TestVoltCompilerAlterDropTable method verifyTableGone.

//Check given table is gone
private void verifyTableGone(VoltCompiler compiler, String tableName) {
    Database db = compiler.m_catalog.getClusters().get("cluster").getDatabases().get("database");
    Table table = db.getTables().get(tableName);
    assertNull(table);
}
Also used : Table(org.voltdb.catalog.Table) Database(org.voltdb.catalog.Database)

Aggregations

Database (org.voltdb.catalog.Database)62 Table (org.voltdb.catalog.Table)22 Catalog (org.voltdb.catalog.Catalog)12 Cluster (org.voltdb.catalog.Cluster)10 File (java.io.File)9 Column (org.voltdb.catalog.Column)9 Procedure (org.voltdb.catalog.Procedure)9 IOException (java.io.IOException)5 VoltTable (org.voltdb.VoltTable)5 ArrayList (java.util.ArrayList)4 Group (org.voltdb.catalog.Group)4 Connector (org.voltdb.catalog.Connector)3 Constraint (org.voltdb.catalog.Constraint)3 Statement (org.voltdb.catalog.Statement)3 FileNotFoundException (java.io.FileNotFoundException)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 SimpleDateFormat (java.text.SimpleDateFormat)2 HashMap (java.util.HashMap)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 JAXBException (javax.xml.bind.JAXBException)2