Package org.hsqldb_voltpatches.lib

Examples of org.hsqldb_voltpatches.lib.HsqlArrayList


    }

    public Result executeDirectStatement(Result cmd) {

        String        sql = cmd.getMainString();
        HsqlArrayList list;

        try {
            list = parser.compileStatements(sql, cmd.getStatementType());
        } catch (HsqlException e) {
            return Result.newErrorResult(e);
        }

        Result result = null;

        for (int i = 0; i < list.size(); i++) {
            Statement cs = (Statement) list.get(i);

            result = executeCompiledStatement(cs, ValuePool.emptyObjectArray);

            if (result.isError()) {
                break;
View Full Code Here


    HsqlArrayList sqlWarnings;

    public void addWarning(HsqlException warning) {

        if (sqlWarnings == null) {
            sqlWarnings = new HsqlArrayList(true);
        }
// A VoltDB extension to avoid memory waste.
        // Only the last warning is ever asked for, so just keep overwriting any existing one.
        // So, why do we need a List? Good question. Just trying to minimize the code change for now.
        else {
View Full Code Here

                    describe(session));
        }

        StatementSchema cs;
        Result          result      = statements[0].execute(session);
        HsqlArrayList   constraints = new HsqlArrayList();

        if (statements.length == 1 || result.isError()) {
            return result;
        }

        HsqlName oldSessionSchema = session.getCurrentSchemaHsqlName();

        for (int i = 1; i < statements.length; i++) {
            try {
                session.setSchema(schemaName.name);
            } catch (HsqlException e) {}

            statements[i].setSchemaHsqlName(schemaName);
            session.parser.reset(statements[i].getSQL());

            try {
                session.parser.read();

                switch (statements[i].getType()) {

                    case StatementTypes.GRANT :
                    case StatementTypes.GRANT_ROLE :
                        result = statements[i].execute(session);
                        break;

                    case StatementTypes.CREATE_TABLE :
                        cs                    = session.parser.compileCreate();
                        cs.isSchemaDefinition = true;

                        cs.setSchemaHsqlName(schemaName);

                        if (session.parser.token.tokenType
                                != Tokens.X_ENDPARSE) {
                            throw session.parser.unexpectedToken();
                        }

                        result = cs.execute(session);

                        constraints.addAll((HsqlArrayList) cs.arguments[1]);
                        ((HsqlArrayList) cs.arguments[1]).clear();
                        break;

                    case StatementTypes.CREATE_ROLE :
                    case StatementTypes.CREATE_SEQUENCE :
                    case StatementTypes.CREATE_TYPE :
                    case StatementTypes.CREATE_CHARACTER_SET :
                    case StatementTypes.CREATE_COLLATION :
                        result = statements[i].execute(session);
                        break;

                    case StatementTypes.CREATE_INDEX :
                    case StatementTypes.CREATE_TRIGGER :
                    case StatementTypes.CREATE_VIEW :
                    case StatementTypes.CREATE_DOMAIN :
                    case StatementTypes.CREATE_ROUTINE :
                        cs                    = session.parser.compileCreate();
                        cs.isSchemaDefinition = true;

                        cs.setSchemaHsqlName(schemaName);

                        if (session.parser.token.tokenType
                                != Tokens.X_ENDPARSE) {
                            throw session.parser.unexpectedToken();
                        }

                        result = cs.execute(session);
                        break;

                    case StatementTypes.CREATE_ASSERTION :
                    case StatementTypes.CREATE_TRANSFORM :
                    case StatementTypes.CREATE_TRANSLATION :
                    case StatementTypes.CREATE_CAST :
                    case StatementTypes.CREATE_ORDERING :
                        throw session.parser.unsupportedFeature();
                    default :
                        throw Error.runtimeError(ErrorCode.U_S0500, "");
                }

                if (result.isError()) {
                    break;
                }
            } catch (HsqlException e) {
                result = Result.newErrorResult(e, statements[i].getSQL());
            }
        }

        if (!result.isError()) {
            try {
                for (int i = 0; i < constraints.size(); i++) {
                    Constraint c = (Constraint) constraints.get(i);
                    Table table =
                        session.database.schemaManager.getUserTable(session,
                            c.core.refTableName);

                    ParserDDL.addForeignKey(session, table, c, null);
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.