Package org.hsqldb_voltpatches.lib

Examples of org.hsqldb_voltpatches.lib.HsqlArrayList


    /**
     * checkValidCheckConstraint
     */
    public void checkValidCheckConstraint() {

        HsqlArrayList set = new HsqlArrayList();

        Expression.collectAllExpressions(set, this, subqueryExpressionSet,
                                         emptyExpressionSet);

        if (!set.isEmpty()) {
            throw Error.error(ErrorCode.X_0A000,
                              "subquery in check constraint");
        }
    }
View Full Code Here


        return voltGetXML(session);
    }

    // A VoltDB extension to support indexed expressions
    private void resolveTableColumns(Table table) {
        HsqlList set = new HsqlArrayList();
        collectAllColumnExpressions(set);
        for (int i = 0; i < set.size(); i++) {
            ExpressionColumn array_element = (ExpressionColumn)set.get(i);
            ColumnSchema column = table.getColumn(table.getColumnIndex(array_element.getAlias()));
            array_element.setAttributesAsColumn(column, false);

        }
    }
View Full Code Here

        }
    }

    String[] getSQL(OrderedHashSet resolved, OrderedHashSet unresolved) {

        HsqlArrayList list = new HsqlArrayList();

        if (!(map instanceof HashMappedList)) {
            return null;
        }

        if (map.isEmpty()) {
            return ValuePool.emptyStringArray;
        }

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

        if (type == SchemaObject.FUNCTION || type == SchemaObject.PROCEDURE) {
            OrderedHashSet set = new OrderedHashSet();

            while (it.hasNext()) {
                RoutineSchema routine = (RoutineSchema) it.next();

                for (int i = 0; i < routine.routines.length; i++) {
                    set.add(routine.routines[i]);
                }
            }

            it = set.iterator();
        }

        while (it.hasNext()) {
            SchemaObject   object     = (SchemaObject) it.next();
            OrderedHashSet references = object.getReferences();

            if (references != null) {
                boolean isResolved = true;

                for (int j = 0; j < references.size(); j++) {
                    HsqlName name = (HsqlName) references.get(j);

                    if (SqlInvariants.isSchemaNameSystem(name)) {
                        continue;
                    }

                    if (name.type == SchemaObject.COLUMN) {
                        name = name.parent;
                    }

                    if (name.type == SchemaObject.CHARSET) {

                        // some built-in character sets have no schema
                        if (name.schema == null) {
                            continue;
                        }
                    }

                    if (!resolved.contains(name)) {
                        isResolved = false;

                        break;
                    }
                }

                if (!isResolved) {
                    unresolved.add(object);

                    continue;
                }
            }

            resolved.add(object.getName());

            if (object.getType() == SchemaObject.TABLE) {
                list.addAll(((Table) object).getSQL(resolved, unresolved));
            } else {
                list.add(object.getSQL());
            }
        }

        String[] array = new String[list.size()];

        list.toArray(array);

        return array;
    }
View Full Code Here

                    return Result.newErrorResult(e, sql);
                }
            }
            case StatementTypes.CREATE_TABLE : {
                Table         table              = (Table) arguments[0];
                HsqlArrayList tempConstraints = (HsqlArrayList) arguments[1];
                StatementDMQL statement = (StatementDMQL) arguments[2];
                HsqlArrayList foreignConstraints = null;

                try {
                    setOrCheckObjectName(session, null, table.getName(), true);
                } catch (HsqlException e) {
                    return Result.newErrorResult(e, sql);
                }

                try {
                    if (isSchemaDefinition) {
                        foreignConstraints = new HsqlArrayList();
                    }

                    if (tempConstraints != null) {
                        table =
                            ParserDDL.addTableConstraintDefinitions(session,
View Full Code Here

                                 boolean cascade) {

        Grantee role = session.database.getGranteeManager().getRole(name.name);

        if (!cascade && session.database.schemaManager.hasSchemas(role)) {
            HsqlArrayList list =
                session.database.schemaManager.getSchemas(role);
            Schema schema = (Schema) list.get(0);

            throw Error.error(ErrorCode.X_42502,
                              schema.getName().statementName);
        }
View Full Code Here

        if (session.database.getSessionManager().isUserActive(name.name)) {
            throw Error.error(ErrorCode.X_42539);
        }

        if (!cascade && session.database.schemaManager.hasSchemas(grantee)) {
            HsqlArrayList list =
                session.database.schemaManager.getSchemas(grantee);
            Schema schema = (Schema) list.get(0);

            throw Error.error(ErrorCode.X_42502,
                              schema.getName().statementName);
        }
View Full Code Here

    }

    Expression XreadRowElementList(boolean multiple) {

        Expression    e;
        HsqlArrayList list = new HsqlArrayList();

        while (true) {
            e = XreadValueExpression();

            list.add(e);

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

                continue;
            }

            if (multiple && list.size() == 1) {
                return e;
            }

            break;
        }

        Expression[] array = new Expression[list.size()];

        list.toArray(array);

        return new Expression(OpTypes.ROW, array);
    }
View Full Code Here

        if (routineSchema == null) {
            throw Error.error(ErrorCode.X_42501, name);
        }

        HsqlArrayList list = new HsqlArrayList();

        readThis(Tokens.OPENBRACKET);

        if (token.tokenType == Tokens.CLOSEBRACKET) {
            read();
        } else {
            while (true) {
                Expression e = XreadValueExpression();

                list.add(e);

                if (token.tokenType == Tokens.COMMA) {
                    read();
                } else {
                    readThis(Tokens.CLOSEBRACKET);

                    break;
                }
            }
        }

        FunctionSQLInvoked function  = new FunctionSQLInvoked(routineSchema);
        Expression[]       arguments = new Expression[list.size()];

        list.toArray(arguments);
        function.setArguments(arguments);
        compileContext.addRoutine(function);

        return function;
    }
View Full Code Here

            return function;
            ... disabled 1 line */
            // End of VoltDB extension
        }

        HsqlArrayList exprList = new HsqlArrayList();

        // A VoltDB extension to avoid using exceptions for flow control.
        HsqlException e = null;
        try {
            e = readExpression(exprList, parseList, 0, parseList.length, false, false);
        } catch (HsqlException caught) {
            e = caught;
        }
        if (e != null) {
            if (function.parseListAlt == null) {
                if ( ! preferToThrow) {
                    return new ExpressionOrException(e);
                }
        /* disable 4 lines ...
        try {
            readExpression(exprList, parseList, 0, parseList.length, false);
        } catch (HsqlException e) {
            if (function.parseListAlt == null) {
        ... disabled 4 lines */
        // End of VoltDB extension
                throw e;
            }

            rewind(position);

            parseList = function.parseListAlt;
            exprList  = new HsqlArrayList();

            // A VoltDB extension to avoid using exceptions for flow control.
            e = readExpression(exprList, parseList, 0, parseList.length, false, preferToThrow);
            if (e != null) {
                if ( ! preferToThrow ) {
                    return new ExpressionOrException(e);
                }
                // It's a little strange to be here -- should have thrown already.
                // But better late than sorry.
                throw e;
            }
            /* disable 1 line ...
            readExpression(exprList, parseList, 0, parseList.length, false);
            ... disabled 1 line */
            // End of VoltDB extension
        }

        Expression[] expr = new Expression[exprList.size()];

        exprList.toArray(expr);
        function.setArguments(expr);

        // A VoltDB extension to avoid using exceptions for flow control.
        return new ExpressionOrException(function.getFunctionExpression());
        /* disable 1 line ...
View Full Code Here

                classname, e
            });
        }

        Method[]      methods = classinstance.getMethods();
        HsqlArrayList list    = new HsqlArrayList();

        for (i = 0; i < methods.length; i++) {
            int    offset    = 0;
            Method m         = methods[i];
            int    modifiers = m.getModifiers();

            if (!m.getName().equals(methodname)
                    || !Modifier.isStatic(modifiers)
                    || !Modifier.isPublic(modifiers)) {
                continue;
            }

            Class[] params = methods[i].getParameterTypes();

            if (params.length > 0
                    && params[0].equals(java.sql.Connection.class)) {
                offset = 1;
            }

            for (int j = offset; j < params.length; j++) {
                Class param = params[j];
                Type methodParamType = Type.getDefaultTypeWithSize(
                    Types.getParameterSQLTypeNumber(param));

                if (methodParamType == null) {
                    m = null;

                    break;
                }
            }

            if (m == null) {
                continue;
            }

            Type methodReturnType = Type.getDefaultTypeWithSize(
                Types.getParameterSQLTypeNumber(m.getReturnType()));

            if (methodReturnType != null) {
                list.add(methods[i]);
            }
        }

        methods = new Method[list.size()];

        list.toArray(methods);

        return methods;
    }
View Full Code Here

TOP

Related Classes of org.hsqldb_voltpatches.lib.HsqlArrayList

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.