Search in sources :

Example 11 with ColPermsDescriptor

use of org.apache.derby.iapi.sql.dictionary.ColPermsDescriptor in project derby by apache.

the class SYSCOLPERMSRowFactory method orPermissions.

/**
 * Or a set of permissions in with a row from this catalog table
 *
 * @param row an existing row
 * @param perm a permission descriptor of the appropriate class for this PermissionsCatalogRowFactory class.
 * @param colsChanged An array with one element for each column in row. It is updated to
 *                    indicate which columns in row were changed
 *
 * @return The number of columns that were changed.
 *
 * @exception StandardException standard error policy
 */
public int orPermissions(ExecRow row, PermissionsDescriptor perm, boolean[] colsChanged) throws StandardException {
    ColPermsDescriptor colPerms = (ColPermsDescriptor) perm;
    FormatableBitSet existingColSet = (FormatableBitSet) row.getColumn(COLUMNS_COL_NUM).getObject();
    FormatableBitSet newColSet = colPerms.getColumns();
    boolean changed = false;
    for (int i = newColSet.anySetBit(); i >= 0; i = newColSet.anySetBit(i)) {
        if (!existingColSet.get(i)) {
            existingColSet.set(i);
            changed = true;
        }
    }
    if (changed) {
        colsChanged[COLUMNS_COL_NUM - 1] = true;
        return 1;
    }
    return 0;
}
Also used : ColPermsDescriptor(org.apache.derby.iapi.sql.dictionary.ColPermsDescriptor) FormatableBitSet(org.apache.derby.iapi.services.io.FormatableBitSet)

Aggregations

ColPermsDescriptor (org.apache.derby.iapi.sql.dictionary.ColPermsDescriptor)11 FormatableBitSet (org.apache.derby.iapi.services.io.FormatableBitSet)6 UUID (org.apache.derby.catalog.UUID)3 LanguageConnectionContext (org.apache.derby.iapi.sql.conn.LanguageConnectionContext)3 DataDictionary (org.apache.derby.iapi.sql.dictionary.DataDictionary)3 DependencyManager (org.apache.derby.iapi.sql.depend.DependencyManager)2 PermissionsDescriptor (org.apache.derby.iapi.sql.dictionary.PermissionsDescriptor)2 SchemaDescriptor (org.apache.derby.iapi.sql.dictionary.SchemaDescriptor)2 StatementColumnPermission (org.apache.derby.iapi.sql.dictionary.StatementColumnPermission)2 StatementPermission (org.apache.derby.iapi.sql.dictionary.StatementPermission)2 StatementRolePermission (org.apache.derby.iapi.sql.dictionary.StatementRolePermission)2 StatementSchemaPermission (org.apache.derby.iapi.sql.dictionary.StatementSchemaPermission)2 TablePermsDescriptor (org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor)2 ExecIndexRow (org.apache.derby.iapi.sql.execute.ExecIndexRow)2 ExecRow (org.apache.derby.iapi.sql.execute.ExecRow)2 DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)2 SQLChar (org.apache.derby.iapi.types.SQLChar)2 UserType (org.apache.derby.iapi.types.UserType)2 Iterator (java.util.Iterator)1 AliasDescriptor (org.apache.derby.iapi.sql.dictionary.AliasDescriptor)1