Package org.hsqldb_voltpatches.lib

Examples of org.hsqldb_voltpatches.lib.OrderedHashSet


            name = database.nameManager.newAutoName("FK",
                    table.getSchemaName(), table.getName(),
                    SchemaObject.CONSTRAINT);
        }

        OrderedHashSet set           = readColumnNames(false);
        Constraint     c             = readFKReferences(table, name, set);
        HsqlName       mainTableName = c.getMainTableName();

        c.core.mainTable = database.schemaManager.getTable(session,
                mainTableName.name, mainTableName.schema.name);
View Full Code Here


        }
    }

    private StatementSchema compileRightGrantOrRevoke(boolean grant) {

        OrderedHashSet granteeList = new OrderedHashSet();
        Grantee        grantor     = null;
        Right          right       = null;

//        SchemaObject   schemaObject;
        HsqlName objectName    = null;
        boolean  isTable       = false;
        boolean  isUsage       = false;
        boolean  isExec        = false;
        boolean  isAll         = false;
        boolean  isGrantOption = false;
        boolean  cascade       = false;

        if (!grant) {
            if (token.tokenType == Tokens.GRANT) {
                read();
                readThis(Tokens.OPTION);
                readThis(Tokens.FOR);

                isGrantOption = true;

                // throw not suppoerted
            } else if (token.tokenType == Tokens.HIERARCHY) {
                throw unsupportedFeature();
/*
                read();
                readThis(Token.OPTION);
                readThis(Token.FOR);
*/
            }
        }

        // ALL means all the rights the grantor can grant
        if (token.tokenType == Tokens.ALL) {
            read();

            if (token.tokenType == Tokens.PRIVILEGES) {
                read();
            }

            right = Right.fullRights;
            isAll = true;
        } else {
            right = new Right();

            boolean loop = true;

            while (loop) {
                checkIsNotQuoted();

                int rightType =
                    GranteeManager.getCheckSingleRight(token.tokenString);
                int            grantType = token.tokenType;
                OrderedHashSet columnSet = null;

                read();

                switch (grantType) {

View Full Code Here

    }

    private StatementSchema compileRoleGrantOrRevoke(boolean grant) {

        Grantee        grantor     = session.getGrantee();
        OrderedHashSet roleList    = new OrderedHashSet();
        OrderedHashSet granteeList = new OrderedHashSet();
        boolean        cascade     = false;

        if (!grant && token.tokenType == Tokens.ADMIN) {
            throw unsupportedFeature();
/*
            read();
            readThis(Token.OPTION);
            readThis(Token.FOR);
*/
        }

        while (true) {
            checkIsSimpleName();
            roleList.add(token.tokenString);
            read();

            if (token.tokenType == Tokens.COMMA) {
                read();

                continue;
            }

            break;
        }

        if (grant) {
            readThis(Tokens.TO);
        } else {
            readThis(Tokens.FROM);
        }

        while (true) {
            checkIsSimpleName();
            granteeList.add(token.tokenString);
            read();

            if (token.tokenType == Tokens.COMMA) {
                read();
            } else {
View Full Code Here

    }

    /// Collect the names of the columns being indexed, or null if indexing anything more general than columns.
    /// This adapts XreadExpressions output to the format originally produced by readColumnNames
    private OrderedHashSet getSimpleColumnNames(java.util.List<Expression> indexExprs) {
        OrderedHashSet set = new OrderedHashSet();

        for (Expression expression : indexExprs) {
            if (expression instanceof ExpressionColumn) {
                String colName = ((ExpressionColumn)expression).columnName;
                if (!set.add(colName)) {
                    throw Error.error(ErrorCode.X_42577, colName);
                }
            } else {
                return null;
            }
View Full Code Here

        return set;
    }

    /// Collect the names of the unique columns underlying a list of indexed expressions.
    private OrderedHashSet getBaseColumnNames(java.util.List<Expression> indexExprs) {
        OrderedHashSet set = new OrderedHashSet();

        HsqlList col_list = new HsqlArrayList();
        for (Expression expression : indexExprs) {
            expression.collectAllColumnExpressions(col_list);
        }

        for (int i = 0; i < col_list.size(); i++) {
            String colName = ((ExpressionColumn)col_list.get(i)).columnName;
            set.add(colName);
        }

        return set;
    }
View Full Code Here

                row[is_grantable] = "YES";

                t.insertSys(store, row);
            }
        } else {
            OrderedHashSet roles = role.getDirectRoles();

            for (int i = 0; i < roles.size(); i++) {
                String   roleName = (String) roles.get(i);
                Object[] row      = t.getEmptyRowData();

                row[grantee]      = role.getNameString();
                row[role_name]    = roleName;
                row[is_grantable] = Tokens.T_NO;
View Full Code Here

        Iterator       tables;
        Table          table;
        Constraint[]   constraints;
        int            constraintCount;
        Constraint     constraint;
        OrderedHashSet collector;
        Iterator       iterator;
        OrderedHashSet methodSet;
        Method         method;
        Object[]       row;

        tables =
            database.schemaManager.databaseObjectIterator(SchemaObject.TABLE);
        collector = new OrderedHashSet();

        while (tables.hasNext()) {
            collector.clear();

            table = (Table) tables.next();

            if (table.isView()
                    || !session.getGrantee().isFullyAccessibleByRole(table)) {
                continue;
            }

            constraints       = table.getConstraints();
            constraintCount   = constraints.length;
            constraintCatalog = database.getCatalogName().name;
            constraintSchema  = table.getSchemaName().name;
            specificSchema =
                database.schemaManager.getDefaultSchemaHsqlName().name;

            for (int i = 0; i < constraintCount; i++) {
                constraint = constraints[i];

                if (constraint.getConstraintType() != Constraint.CHECK) {
                    continue;
                }

                constraintName = constraint.getName().name;

                constraint.getCheckExpression().collectAllFunctionExpressions(
                    collector);

                methodSet = new OrderedHashSet();
                iterator  = collector.iterator();

                while (iterator.hasNext()) {
/*
                    Function expression = (Function) iterator.next();
                    String className =
                        expression.getMethod().getDeclaringClass().getName();
                    String schema =
                        database.schemaManager.getDefaultSchemaHsqlName().name;
                    SchemaObject object =
                        database.schemaManager.getSchemaObject(className,
                            schema, SchemaObject.FUNCTION);

                    if (!session.getGrantee().isAccessible(object)) {
                        continue;
                    }

                    methodSet.add(expression.getMethod());
*/
                }

                iterator = methodSet.iterator();

                while (iterator.hasNext()) {
                    method                  = (Method) iterator.next();
                    row                     = t.getEmptyRowData();
                    row[constraint_catalog] = constraintCatalog;
View Full Code Here

        int            columnCount;
        Iterator       tables;
        Table          table;
        Object[]       row;
        DITableInfo    ti;
        OrderedHashSet columnList;
        Type           type;

        // Initialization
        tables = allTables();
        ti     = new DITableInfo();

        while (tables.hasNext()) {
            table = (Table) tables.next();
            columnList =
                session.getGrantee().getColumnsForAllPrivileges(table);

            if (columnList.isEmpty()) {
                continue;
            }

            ti.setTable(table);

            columnCount = table.getColumnCount();

            for (int i = 0; i < columnCount; i++) {
                ColumnSchema column = table.getColumn(i);

                type = column.getDataType();

                if (!columnList.contains(column.getName())) {
                    continue;
                }

                row                   = t.getEmptyRowData();
                row[table_cat]        = table.getCatalogName().name;
View Full Code Here

                constraintName = constraint.getName().name;

                switch (constraint.getConstraintType()) {

                    case Constraint.CHECK : {
                        OrderedHashSet expressions =
                            constraint.getCheckColumnExpressions();

                        if (expressions == null) {
                            break;
                        }

                        iterator = expressions.iterator();

                        // calculate distinct column references
                        while (iterator.hasNext()) {
                            ExpressionColumn expr =
                                (ExpressionColumn) iterator.next();
View Full Code Here

            }

            Routine[] specifics = routine.getSpecificRoutines();

            for (int m = 0; m < specifics.length; m++) {
                OrderedHashSet set = specifics[m].getReferences();

                for (int i = 0; i < set.size(); i++) {
                    HsqlName refName = (HsqlName) set.get(i);

                    if (refName.type != SchemaObject.COLUMN) {
                        continue;
                    }
View Full Code Here

TOP

Related Classes of org.hsqldb_voltpatches.lib.OrderedHashSet

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.