Package org.hsqldb_voltpatches.lib

Examples of org.hsqldb_voltpatches.lib.HsqlArrayList


    StatementSimple compileSetStatement(RangeVariable rangeVars[]) {

        read();

        OrderedHashSet colNames = new OrderedHashSet();
        HsqlArrayList  exprList = new HsqlArrayList();

        readSetClauseList(rangeVars, colNames, exprList);

        if (exprList.size() > 1) {
            throw Error.error(ErrorCode.X_42602);
        }

        Expression expression = (Expression) exprList.get(0);

        if (expression.getDegree() != colNames.size()) {

//            throw Error.error(ErrorCode.X_42546);
        }
View Full Code Here


*/
    private Object[] readLocalDeclarationList(Routine routine,
            StatementCompound context) {

        HsqlArrayList list = new HsqlArrayList();

        while (token.tokenType == Tokens.DECLARE) {
            Object var = readLocalVariableDeclarationOrNull();

            if (var == null) {
                var = readLocalHandlerDeclaration(routine, context);
            }

            list.add(var);
        }

        Object[] declarations = new Object[list.size()];

        list.toArray(declarations);

        return declarations;
    }
View Full Code Here

        return array;
    }

    public String[] getRightstSQL() {

        HsqlArrayList list     = new HsqlArrayList();
        Iterator      grantees = getGrantees().iterator();

        while (grantees.hasNext()) {
            Grantee grantee = (Grantee) grantees.next();
            String  name    = grantee.getNameString();

            // _SYSTEM user, DBA Role grants not persisted
            if (GranteeManager.isImmutable(name)) {
                continue;
            }

            HsqlArrayList subList = grantee.getRightsSQL();

            list.addAll(subList);
        }

        String[] array = new String[list.size()];
View Full Code Here

            throw unexpectedToken();
        }

        readThis(Tokens.SEMICOLON);

        HsqlArrayList list = new HsqlArrayList();

        list.add(e);

        while (true) {
            e = readSQLProcedureStatementOrNull(routine, context);

            if (e == null) {
                break;
            }

            readThis(Tokens.SEMICOLON);
            list.add(e);
        }

        Statement[] statements = new Statement[list.size()];

        list.toArray(statements);

        return statements;
    }
View Full Code Here

        return result;
    }

    private Statement readIf(Routine routine, StatementCompound context) {

        HsqlArrayList list = new HsqlArrayList();
        RangeVariable[] rangeVariables = context == null
                                         ? routine.getParameterRangeVariables()
                                         : context.getRangeVariables();
        HsqlList unresolved = null;

        readThis(Tokens.IF);

        Expression condition = XreadBooleanValueExpression();

        unresolved = condition.resolveColumnReferences(rangeVariables,
                rangeVariables.length, unresolved, false);

        ExpressionColumn.checkColumnsResolved(unresolved);

        unresolved = null;

        condition.resolveTypes(session, null);

        Statement statement = new StatementSimple(StatementTypes.CONDITION,
            condition);

        list.add(statement);
        readThis(Tokens.THEN);

        Statement[] statements = readSQLProcedureStatementList(routine,
            context);

        for (int i = 0; i < statements.length; i++) {
            list.add(statements[i]);
        }

        while (token.tokenType == Tokens.ELSEIF) {
            read();

            condition = XreadBooleanValueExpression();
            unresolved = condition.resolveColumnReferences(rangeVariables,
                    rangeVariables.length, unresolved, false);

            ExpressionColumn.checkColumnsResolved(unresolved);

            unresolved = null;

            condition.resolveTypes(session, null);

            statement = new StatementSimple(StatementTypes.CONDITION,
                                            condition);

            list.add(statement);
            readThis(Tokens.THEN);

            statements = readSQLProcedureStatementList(routine, context);

            for (int i = 0; i < statements.length; i++) {
                list.add(statements[i]);
            }
        }

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

            condition = Expression.EXPR_TRUE;
            statement = new StatementSimple(StatementTypes.CONDITION,
                                            condition);

            list.add(statement);

            statements = readSQLProcedureStatementList(routine, context);

            for (int i = 0; i < statements.length; i++) {
                list.add(statements[i]);
            }
        }

        readThis(Tokens.END);
        readThis(Tokens.IF);

        statements = new Statement[list.size()];

        list.toArray(statements);

        StatementCompound result = new StatementCompound(StatementTypes.IF,
            null);

        result.setStatements(statements);
View Full Code Here

        return result;
    }

    private Statement readCase(Routine routine, StatementCompound context) {

        HsqlArrayList list      = new HsqlArrayList();
        Expression    condition = null;
        Statement     statement;
        Statement[]   statements;

        readThis(Tokens.CASE);

        if (token.tokenType == Tokens.WHEN) {
            list = readCaseWhen(routine, context);
        } else {
            list = readSimpleCaseWhen(routine, context);
        }

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

            condition = Expression.EXPR_TRUE;
            statement = new StatementSimple(StatementTypes.CONDITION,
                                            condition);

            list.add(statement);

            statements = readSQLProcedureStatementList(routine, context);

            for (int i = 0; i < statements.length; i++) {
                list.add(statements[i]);
            }
        }

        readThis(Tokens.END);
        readThis(Tokens.CASE);

        statements = new Statement[list.size()];

        list.toArray(statements);

        StatementCompound result = new StatementCompound(StatementTypes.IF,
            null);

        result.setStatements(statements);
View Full Code Here

    }

    private HsqlArrayList readSimpleCaseWhen(Routine routine,
            StatementCompound context) {

        HsqlArrayList list = new HsqlArrayList();
        RangeVariable[] rangeVariables = context == null
                                         ? routine.getParameterRangeVariables()
                                         : context.getRangeVariables();
        HsqlList    unresolved = null;
        Expression  condition  = null;
        Statement   statement;
        Statement[] statements;
        Expression  predicand = XreadRowValuePredicand();

        do {
            readThis(Tokens.WHEN);

            do {
                Expression newCondition = XreadPredicateRightPart(predicand);

                if (predicand == newCondition) {
                    newCondition =
                        new ExpressionLogical(predicand,
                                              XreadRowValuePredicand());
                }

                unresolved =
                    newCondition.resolveColumnReferences(rangeVariables,
                        rangeVariables.length, unresolved, false);

                ExpressionColumn.checkColumnsResolved(unresolved);

                unresolved = null;

                newCondition.resolveTypes(session, null);

                if (condition == null) {
                    condition = newCondition;
                } else {
                    condition = new ExpressionLogical(OpTypes.OR, condition,
                                                      newCondition);
                }

                if (token.tokenType == Tokens.COMMA) {
                    read();
                } else {
                    break;
                }
            } while (true);

            statement = new StatementSimple(StatementTypes.CONDITION,
                                            condition);

            list.add(statement);
            readThis(Tokens.THEN);

            statements = readSQLProcedureStatementList(routine, context);

            for (int i = 0; i < statements.length; i++) {
                list.add(statements[i]);
            }

            if (token.tokenType != Tokens.WHEN) {
                break;
            }
View Full Code Here

    }

    public void push() {

        if (stack == null) {
            stack = new HsqlArrayList(true);
        }

        stack.add(dynamicArguments);
        stack.add(routineArguments);
        stack.add(routineVariables);
View Full Code Here

    }

    public void pushDynamicArguments(Object[] args) {

        if (stack == null) {
            stack = new HsqlArrayList(true);
        }

        stack.add(dynamicArguments);

        dynamicArguments = args;
View Full Code Here

        Expression[]   updateExpressions;
        int[]          columnMap;
        boolean[]      columnCheckList;
        OrderedHashSet colNames = new OrderedHashSet();
        HsqlArrayList  exprList = new HsqlArrayList();
        RangeVariable[] rangeVariables = {
            readSimpleRangeVariable(StatementTypes.UPDATE_WHERE) };
        Table table     = rangeVariables[0].rangeTable;
        Table baseTable = table.getBaseTable();

        readThis(Tokens.SET);
        readSetClauseList(rangeVariables, colNames, exprList);

        columnMap         = table.getColumnIndexes(colNames);
        columnCheckList   = table.getColumnCheckList(columnMap);
        updateExpressions = new Expression[exprList.size()];

        exprList.toArray(updateExpressions);

        Expression condition = null;

        if (token.tokenType == Tokens.WHERE) {
            read();
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.