Search in sources :

Example 81 with OrderedHashSet

use of org.hsqldb_voltpatches.lib.OrderedHashSet in project voltdb by VoltDB.

the class RangeVariable method getColumnNames.

public OrderedHashSet getColumnNames() {
    if (columnNames == null) {
        columnNames = new OrderedHashSet();
        rangeTable.getColumnNames(this.usedColumns, columnNames);
    }
    return columnNames;
}
Also used : OrderedHashSet(org.hsqldb_voltpatches.lib.OrderedHashSet)

Example 82 with OrderedHashSet

use of org.hsqldb_voltpatches.lib.OrderedHashSet in project voltdb by VoltDB.

the class Grantee method getAllRoles.

/**
     * Gets direct and indirect roles.
     */
public OrderedHashSet getAllRoles() {
    OrderedHashSet set = getGranteeAndAllRoles();
    // Since we added "Grantee" in addition to Roles, need to remove self.
    set.remove(this);
    return set;
}
Also used : OrderedHashSet(org.hsqldb_voltpatches.lib.OrderedHashSet)

Example 83 with OrderedHashSet

use of org.hsqldb_voltpatches.lib.OrderedHashSet in project voltdb by VoltDB.

the class Grantee method getAllDirectPrivileges.

public OrderedHashSet getAllDirectPrivileges(SchemaObject object) {
    if (object.getOwner() == this) {
        OrderedHashSet set = new OrderedHashSet();
        set.add(ownerRights);
        return set;
    }
    Iterator rights = directRightsMap.get(object.getName());
    if (rights.hasNext()) {
        OrderedHashSet set = new OrderedHashSet();
        while (rights.hasNext()) {
            set.add(rights.next());
        }
        return set;
    }
    return Right.emptySet;
}
Also used : Iterator(org.hsqldb_voltpatches.lib.Iterator) WrapperIterator(org.hsqldb_voltpatches.lib.WrapperIterator) OrderedHashSet(org.hsqldb_voltpatches.lib.OrderedHashSet)

Example 84 with OrderedHashSet

use of org.hsqldb_voltpatches.lib.OrderedHashSet in project voltdb by VoltDB.

the class Constraint method getCheckColumnExpressions.

public OrderedHashSet getCheckColumnExpressions() {
    OrderedHashSet set = new OrderedHashSet();
    Expression.collectAllExpressions(set, check, Expression.columnExpressionSet, Expression.emptyExpressionSet);
    return set;
}
Also used : OrderedHashSet(org.hsqldb_voltpatches.lib.OrderedHashSet)

Example 85 with OrderedHashSet

use of org.hsqldb_voltpatches.lib.OrderedHashSet in project voltdb by VoltDB.

the class DatabaseInformationFull method VIEW_TABLE_USAGE.

/**
     * The VIEW_TABLE_USAGE table has one row for each table identified
     * by a <table name> simply contained in a <table reference>
     * that is contained in the &lt;query expression&gt; of a view. <p>
     *
     * <b>Definition</b><p>
     *
     * <pre class="SqlCodeExample">
     * CREATE TABLE SYSTEM_VIEW_TABLE_USAGE (
     *      VIEW_CATALOG    VARCHAR NULL,
     *      VIEW_SCHEMA     VARCHAR NULL,
     *      VIEW_NAME       VARCHAR NULL,
     *      TABLE_CATALOG   VARCHAR NULL,
     *      TABLE_SCHEMA    VARCHAR NULL,
     *      TABLE_NAME      VARCHAR NULL,
     *      UNIQUE( VIEW_CATALOG, VIEW_SCHEMA, VIEW_NAME,
     *              TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME )
     * )
     * </pre>
     *
     * <b>Description:</b><p>
     *
     * <ol>
     * <li> The values of VIEW_CATALOG, VIEW_SCHEMA, and VIEW_NAME are the
     *      catalog name, unqualified schema name, and qualified identifier,
     *      respectively, of the view being described. <p>
     *
     * <li> The values of TABLE_CATALOG, TABLE_SCHEMA, and TABLE_NAME are the
     *      catalog name, unqualified schema name, and qualified identifier,
     *      respectively, of a table identified by a &lt;table name&gt;
     *      simply contained in a &lt;table reference&gt; that is contained in
     *      the &lt;query expression&gt; of the view being described.
     * </ol>
     *
     * @return Table
     */
Table VIEW_TABLE_USAGE() {
    Table t = sysTables[VIEW_TABLE_USAGE];
    if (t == null) {
        t = createBlankTable(sysTableHsqlNames[VIEW_TABLE_USAGE]);
        addColumn(t, "VIEW_CATALOG", SQL_IDENTIFIER);
        addColumn(t, "VIEW_SCHEMA", SQL_IDENTIFIER);
        // not null
        addColumn(t, "VIEW_NAME", SQL_IDENTIFIER);
        addColumn(t, "TABLE_CATALOG", SQL_IDENTIFIER);
        addColumn(t, "TABLE_SCHEMA", SQL_IDENTIFIER);
        // not null
        addColumn(t, "TABLE_NAME", SQL_IDENTIFIER);
        // false PK, as VIEW_CATALOG, VIEW_SCHEMA, TABLE_CATALOG, and/or
        // TABLE_SCHEMA may be NULL
        HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[VIEW_TABLE_USAGE].name, false, SchemaObject.INDEX);
        t.createPrimaryKey(name, new int[] { 0, 1, 2, 3, 4, 5 }, false);
        return t;
    }
    // Column number mappings
    final int view_catalog = 0;
    final int view_schema = 1;
    final int view_name = 2;
    final int table_catalog = 3;
    final int table_schema = 4;
    final int table_name = 5;
    //
    PersistentStore store = database.persistentStoreCollection.getStore(t);
    Iterator tables;
    Table table;
    Object[] row;
    // Initialization
    tables = database.schemaManager.databaseObjectIterator(SchemaObject.TABLE);
    // Do it.
    while (tables.hasNext()) {
        table = (Table) tables.next();
        if (table.isView() && session.getGrantee().isFullyAccessibleByRole(table)) {
        // $FALL-THROUGH$
        } else {
            continue;
        }
        OrderedHashSet references = table.getReferences();
        for (int i = 0; i < references.size(); i++) {
            HsqlName refName = (HsqlName) references.get(i);
            if (!session.getGrantee().isFullyAccessibleByRole(refName)) {
                continue;
            }
            if (refName.type != SchemaObject.TABLE) {
                continue;
            }
            row = t.getEmptyRowData();
            row[view_catalog] = database.getCatalogName().name;
            row[view_schema] = table.getSchemaName().name;
            row[view_name] = table.getName().name;
            row[table_catalog] = database.getCatalogName().name;
            row[table_schema] = refName.schema.name;
            row[table_name] = refName.name;
            try {
                t.insertSys(store, row);
            } catch (HsqlException e) {
            }
        }
    }
    return t;
}
Also used : Table(org.hsqldb_voltpatches.Table) TextTable(org.hsqldb_voltpatches.TextTable) Iterator(org.hsqldb_voltpatches.lib.Iterator) WrapperIterator(org.hsqldb_voltpatches.lib.WrapperIterator) PersistentStore(org.hsqldb_voltpatches.persist.PersistentStore) OrderedHashSet(org.hsqldb_voltpatches.lib.OrderedHashSet) HsqlName(org.hsqldb_voltpatches.HsqlNameManager.HsqlName) SchemaObject(org.hsqldb_voltpatches.SchemaObject) Constraint(org.hsqldb_voltpatches.Constraint) HsqlException(org.hsqldb_voltpatches.HsqlException)

Aggregations

OrderedHashSet (org.hsqldb_voltpatches.lib.OrderedHashSet)86 HsqlName (org.hsqldb_voltpatches.HsqlNameManager.HsqlName)47 Iterator (org.hsqldb_voltpatches.lib.Iterator)26 WrapperIterator (org.hsqldb_voltpatches.lib.WrapperIterator)24 Constraint (org.hsqldb_voltpatches.Constraint)19 SchemaObject (org.hsqldb_voltpatches.SchemaObject)19 PersistentStore (org.hsqldb_voltpatches.persist.PersistentStore)19 Table (org.hsqldb_voltpatches.Table)18 HsqlException (org.hsqldb_voltpatches.HsqlException)16 TextTable (org.hsqldb_voltpatches.TextTable)16 HsqlArrayList (org.hsqldb_voltpatches.lib.HsqlArrayList)11 HsqlList (org.hsqldb_voltpatches.lib.HsqlList)8 Grantee (org.hsqldb_voltpatches.rights.Grantee)6 Routine (org.hsqldb_voltpatches.Routine)5 RoutineSchema (org.hsqldb_voltpatches.RoutineSchema)5 Right (org.hsqldb_voltpatches.rights.Right)5 TriggerDef (org.hsqldb_voltpatches.TriggerDef)4 OrderedIntHashSet (org.hsqldb_voltpatches.lib.OrderedIntHashSet)3 Type (org.hsqldb_voltpatches.types.Type)3 HashMappedList (org.hsqldb_voltpatches.lib.HashMappedList)2