Package org.hsqldb.lib

Examples of org.hsqldb.lib.HashMappedList


    }

    private HashMappedList getUnionColumns() {

        if (unionCorresponding || leftQueryExpression == null) {
            HashMappedList columns = ((TableDerived) resultTable).columnList;
            HashMappedList list    = new HashMappedList();

            for (int i = 0; i < unionColumnMap.length; i++) {
                ColumnSchema column = (ColumnSchema) columns.get(i);

                list.add(column.getName().name, column);
            }

            return list;
        }
View Full Code Here


        if (resultTable == null) {
            return leftQueryExpression.getResultColumnNames();
        }

        HashMappedList list = ((TableDerived) resultTable).columnList;
        HsqlName[]     resultColumnNames = new HsqlName[list.size()];

        for (int i = 0; i < resultColumnNames.length; i++) {
            resultColumnNames[i] = ((ColumnSchema) list.get(i)).getName();
        }

        return resultColumnNames;
    }
View Full Code Here

            if (namedSubqueries.size() <= subqueryDepth) {
                namedSubqueries.setSize(subqueryDepth + 1);
            }

            HashMappedList set =
                (HashMappedList) namedSubqueries.get(subqueryDepth);

            if (set == null) {
                set = new HashMappedList();

                namedSubqueries.set(subqueryDepth, set);
            } else {
                set.clear();
            }
        }
View Full Code Here

            }
        }

        private void registerSubquery(String name, SubQuery subquery) {

            HashMappedList set =
                (HashMappedList) namedSubqueries.get(subqueryDepth);
            boolean added = set.add(name, subquery);

            if (!added) {
                throw Error.error(ErrorCode.X_42504);
            }
        }
View Full Code Here

            for (int i = subqueryDepth; i >= 0; i--) {
                if (namedSubqueries.size() <= i) {
                    continue;
                }

                HashMappedList set = (HashMappedList) namedSubqueries.get(i);

                if (set == null) {
                    continue;
                }

                SubQuery sq = (SubQuery) set.get(name);

                if (sq != null) {
                    return sq;
                }
            }
View Full Code Here

    HashMappedList sessionTables;

    public void addSessionTable(Table table) {

        if (sessionTables == null) {
            sessionTables = new HashMappedList();
        }

        if (sessionTables.containsKey(table.getName().name)) {
            throw Error.error(ErrorCode.X_42504);
        }
View Full Code Here

            }

            return;
        }

        HashMappedList list = new HashMappedList();

        if (parent != null) {
            for (int i = 0; i < parent.scopeVariables.size(); i++) {
                list.add(parent.scopeVariables.getKey(i),
                         parent.scopeVariables.get(i));
            }
        }

        for (int i = 0; i < variables.length; i++) {
            String  name  = variables[i].getName().name;
            boolean added = list.add(name, variables[i]);

            if (!added) {
                throw Error.error(ErrorCode.X_42606, name);
            }

            if (root.getParameterIndex(name) != -1) {
                throw Error.error(ErrorCode.X_42606, name);
            }
        }

        RangeVariable range = new RangeVariable(list, true);

        rangeVariables     = new RangeVariable[] {
            root.getParameterRangeVariables()[0], range
        };
        root.variableCount = list.size();
    }
View Full Code Here

            case SchemaObject.PROCEDURE :
            case SchemaObject.FUNCTION :
            case SchemaObject.SPECIFIC_ROUTINE :
            case SchemaObject.ASSERTION :
            case SchemaObject.TRIGGER :
                map = new HashMappedList();
                break;

            case SchemaObject.COLUMN :
            case SchemaObject.CONSTRAINT :
            case SchemaObject.INDEX :
View Full Code Here

    throws HsqlException {

        Table          t          = null;
        SubQuery       sq         = null;
        String         sAlias     = null;
        HashMappedList columnList = null;

        if (tokenizer.isGetThis(Token.T_OPENBRACKET)) {
            int brackets = parseOpenBrackets();

            tokenizer.getThis(Token.T_SELECT);

            // fredt - not correlated - a joined subquery table must resolve fully
            sq = parseSubquery(brackets, null, true, Expression.QUERY);

            tokenizer.getThis(Token.T_CLOSEBRACKET);

            t = sq.table;
        } else {
            String token = tokenizer.getName();
            String schema =
                session.getSchemaName(tokenizer.getLongNameFirst());

            t = database.schemaManager.getTable(session, token, schema);

            session.check(t.getName(), UserManager.SELECT);

            if (t.isView()) {
                sq        = getViewSubquery((View) t);
                sq.select = ((View) t).viewSelect;
                t         = sq.table;
                sAlias    = token;
            }
        }

        // fredt - we removed LEFT from the list of reserved words in Tokenizer
        // to allow LEFT() to work. Thus wasName() will return true for LEFT
        // and we check separately for this token
        String token = tokenizer.getString();

        if (tokenizer.wasLongName()) {
            tokenizer.throwUnexpected();
        }

        if ((token.equals(Token.T_LEFT) || token.equals(Token.T_RIGHT))
                && !tokenizer.wasQuotedIdentifier()) {
            tokenizer.back();
        } else if (token.equals(Token.T_AS)
                   && !tokenizer.wasQuotedIdentifier()) {
            sAlias = tokenizer.getSimpleName();

            if (tokenizer.isGetThis(Token.T_OPENBRACKET)) {
                tokenizer.back();

                columnList = parseColumnList();
            }
        } else if (tokenizer.wasSimpleName()) {
            sAlias = token;

            if (tokenizer.isGetThis(Token.T_OPENBRACKET)) {
                tokenizer.back();

                columnList = parseColumnList();
            }
        } else {
            tokenizer.back();
        }

        if (columnList != null && t.getColumnCount() != columnList.size()) {
            throw Trace.error(Trace.COLUMN_COUNT_DOES_NOT_MATCH);
        }

        return new TableFilter(t, sAlias, columnList, outerjoin);
    }
View Full Code Here

    }

    static HashMappedList processColumnList(Tokenizer tokenizer,
            boolean acceptAscDesc) throws HsqlException {

        HashMappedList list;
        String         token;

        list = new HashMappedList();

        tokenizer.getThis(Token.T_OPENBRACKET);

        while (true) {
            token = tokenizer.getSimpleName();

            boolean result = list.add(token, null);

            if (!result) {
                throw Trace.error(Trace.COLUMN_ALREADY_EXISTS, token);
            }
View Full Code Here

TOP

Related Classes of org.hsqldb.lib.HashMappedList

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.