Package org.hsqldb.lib

Examples of org.hsqldb.lib.HashSet


            return t;
        }

        DataFileCache cache;
        Object[]      row;
        HashSet       cacheSet;
        Iterator      caches;
        Iterator      tables;
        Table         table;
        int           iFreeBytes;
        int           iLargestFreeItem;
        long          lSmallestFreeItem;

        // column number mappings
        final int icache_file      = 0;
        final int imax_cache_sz    = 1;
        final int imax_cache_bytes = 2;
        final int icache_size      = 3;
        final int icache_length    = 4;
        final int ifree_bytes      = 5;
        final int ifree_count      = 6;
        final int ifree_pos        = 7;

        // Initialization
        cacheSet = new HashSet();

        // dynamic system tables are never cached
        tables = database.schemaManager.allTablesIterator();

        while (tables.hasNext()) {
            table = (Table) tables.next();

            if (table.isFileBased() && isAccessibleTable(table)) {
                cache = table.getCache();

                if (cache != null) {
                    cacheSet.add(cache);
                }
            }
        }

        caches = cacheSet.iterator();

        // Do it.
        while (caches.hasNext()) {
            cache = (DataFileCache) caches.next();
            row   = t.getEmptyRowData();
View Full Code Here


        String isGrantable;

        // intermediate holders
        UserManager   um;
        HsqlArrayList users;
        HashSet       classNameSet;
        Iterator      classNames;
        User          granteeUser;
        Object[]      row;

        // column number mappings
        final int icls_cat   = 0;
        final int icls_schem = 1;
        final int icls_name  = 2;
        final int igrantor   = 3;
        final int igrantee   = 4;
        final int iprivilege = 5;
        final int iis_grntbl = 6;

        // Initialization
        grantorName = GranteeManager.DBA_ADMIN_ROLE_NAME;
        um          = database.getUserManager();
        users       = um.listVisibleUsers(session, true);

        // Do it.
        for (int i = 0; i < users.size(); i++) {
            granteeUser  = (User) users.get(i);
            granteeName  = granteeUser.getName();
            isGrantable  = granteeUser.isAdmin() ? "YES"
                                                 : "NO";
            classNameSet = granteeUser.getGrantedClassNames(false);

            if (granteeUser.isPublic()) {
                ns.addBuiltinToSet(classNameSet);
            }

            classNames = classNameSet.iterator();

// boucherb@users 20030305 - TODO completed.
// "EXECUTE" is closest to correct (from: SQL 200n ROUTINE_PRIVILEGES)
// There is nothing even like CLASS_PRIVILEGES table under SQL 200n spec.
            privilege = "EXECUTE";
View Full Code Here

        Constraint           constraint;
        Expression.Collector collector;
        Expression           expression;
        Function             function;
        Iterator             iterator;
        HashSet              methodSet;
        Method               method;
        Object[]             row;

        // column number mappings
        final int icons_cat   = 0;
        final int icons_schem = 1;
        final int icons_name  = 2;
        final int ir_cat      = 3;
        final int ir_schem    = 4;
        final int ir_name     = 5;

        tables    = database.schemaManager.allTablesIterator();
        collector = new Expression.Collector();

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

            table = (Table) tables.next();

            if (!isAccessibleTable(table)) {
                continue;
            }

            constraints       = table.getConstraints();
            constraintCount   = constraints.length;
            constraintCatalog = ns.getCatalogName(table);
            constraintSchema  = table.getSchemaName();

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

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

                constraintName = constraint.getName().name;

                collector.addAll(constraint.core.check, Expression.FUNCTION);

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

                while (iterator.hasNext()) {
                    expression = (Expression) iterator.next();
                    function   = expression.function;

                    if (!session
                            .isAccessible(function.getMethod()
                                .getDeclaringClass().getName())) {
                        continue;
                    }

                    methodSet.add(function.getMethod());
                }

                iterator = methodSet.iterator();

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

        Constraint[] constraints;
        int          constraintCount;
        Constraint   constraint;
        String       cat;
        String       schem;
        HashSet      constraintSet;
        Object[]     row;

        // column number mappings
        final int icons_cat   = 0;
        final int icons_schem = 1;
        final int icons_name  = 2;
        final int icons_type  = 3;
        final int itab_cat    = 4;
        final int itab_schem  = 5;
        final int itab_name   = 6;
        final int iis_defr    = 7;
        final int iinit_defr  = 8;

        // initialization
        tables        = database.schemaManager.allTablesIterator();
        constraintSet = new HashSet();
        table         = null;    // else complier complains

        // do it
        while (tables.hasNext()) {
            table = (Table) tables.next();

            if (table.isView() || !isAccessibleTable(table)) {
                continue;
            }

            constraints     = table.getConstraints();
            constraintCount = constraints.length;

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

                if (constraint.getType() == Constraint.FOREIGN_KEY
                        && !isAccessibleTable(constraint.getRef())) {
                    continue;
                }

                constraintSet.add(constraint);
            }
        }

        for (Iterator it = constraintSet.iterator(); it.hasNext(); ) {
            row        = t.getEmptyRowData();
            constraint = (Constraint) it.next();

            switch (constraint.getType()) {
View Full Code Here

        Select               select;
        Expression           expression;
        Function             function;
        Expression.Collector collector;
        Method               method;
        HashSet              methodSet;
        Iterator             iterator;

        // Column number mappings
        final int iv_cat   = 0;
        final int iv_schem = 1;
        final int iv_name  = 2;
        final int ir_cat   = 3;
        final int ir_schem = 4;
        final int ir_name  = 5;
        final int ir_sig   = 6;

        // Initialization
        tables    = database.schemaManager.allTablesIterator();
        collector = new Expression.Collector();

        // Do it.
        while (tables.hasNext()) {
            collector.clear();

            table = (Table) tables.next();

            if (table.isView() && isAccessibleTable(table)) {

                // fall through
            } else {
                continue;
            }

            viewCat    = ns.getCatalogName(table);
            viewSchem  = table.getSchemaName();
            viewName   = table.getName().name;
            view       = (View) table;
            subqueries = view.viewSubqueries;

            collector.addAll(view.viewSelect, Expression.FUNCTION);

            for (int i = 0; i < subqueries.length; i++) {
                collector.addAll(subqueries[i].select, Expression.FUNCTION);
            }

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

            while (iterator.hasNext()) {
                expression = (Expression) iterator.next();
                function   = expression.function;

                if (session.isAccessible(
                        function.getMethod().getDeclaringClass().getName())) {
                    methodSet.add(function.getMethod());
                }
            }

            iterator = methodSet.iterator();

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

     */
    protected void init(int protocol) {

        // PRE:  This method is only called from the constructor
        serverState      = ServerConstants.SERVER_STATE_SHUTDOWN;
        serverConnSet    = new HashSet();
        serverId         = toString();
        serverId         = serverId.substring(serverId.lastIndexOf('.') + 1);
        serverProtocol   = protocol;
        serverProperties = ServerConfiguration.newDefaultProperties(protocol);
        logWriter        = new PrintWriter(System.out);
View Full Code Here

        resolveAll(session, true);

        if (iGroupLen > 0) {    // has been set in Parser
            isGrouped        = true;
            groupColumnNames = new HashSet();

            for (int i = iResultLen; i < iResultLen + iGroupLen; i++) {

//              MarcH: this is wrong for a CASE WHEN statement in a SELECT CASE WHEN ...,<something aggregate> statement
//              collectColumnName collects no columns if exprColumns[i]'s expressiontype is Expression.CASEWHEN
View Full Code Here

     * in the given defined column names.
     */
    static boolean allColumnsAreDefinedIn(Expression exp,
                                          HashSet definedColumns) {

        HashSet colNames = new HashSet();

        exp.collectAllColumnNames(colNames);

        if ((colNames.size() > 0) && (definedColumns == null)) {
            return false;
        }

        Iterator i = colNames.iterator();

        while (i.hasNext()) {
            if (!definedColumns.contains(i.next())) {
                return false;
            }
View Full Code Here

        }
    }

    public Set getUserDefinedPropertyData() {

        Set      set = new HashSet();
        Iterator it  = meta.values().iterator();

        while (it.hasNext()) {
            Object[] row = (Object[]) it.next();

            if (((Integer) row[indexAccess]).intValue() == SET_PROPERTY) {
                set.add(row);
            }
        }

        return set;
    }
View Full Code Here

    private static void deRegisterServer(Server server, Database db) {

        Iterator it = serverMap.values().iterator();

        for (; it.hasNext(); ) {
            HashSet databases = (HashSet) it.next();

            databases.remove(db);

            if (databases.isEmpty()) {
                it.remove();
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.hsqldb.lib.HashSet

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.