Package org.hsqldb_voltpatches.result

Examples of org.hsqldb_voltpatches.result.Result


        }
    }

    public Result execute(Session session) {

        Result result = getAccessRightsResult(session);

        if (result != null) {
            return result;
        }

        if (this.isExplain) {
            return Result.newSingleColumnStringResult("OPERATION",
                    describe(session));
        }

        if (session.sessionContext.dynamicArguments.length
                != parameters.length) {

//            return Result.newErrorResult(Error.error(ErrorCode.X_42575));
        }

        try {
            materializeSubQueries(session);

            result = getResult(session);
        } catch (Throwable t) {
            String commandString = sql;

            if (session.database.getProperties().getErrorLevel()
                    == HsqlDatabaseProperties.NO_MESSAGE) {
                commandString = null;
            }

            result = Result.newErrorResult(t, commandString);

            result.getException().setStatementType(group, type);


        }

        session.sessionContext.clearStructures(this);
View Full Code Here


                new Object[variableCount];
        }

        // fixed? temp until assignment of dynamicArguments in materialiseSubqueries is fixed
//        Object[] args   = session.sessionContext.dynamicArguments;
        Result result = procedure.statement.execute(session);

//        session.sessionContext.dynamicArguments = args;
        if (!result.isError()) {
            result = Result.updateZeroResult;
        }

        Object[] callArguments = session.sessionContext.routineArguments;

        session.sessionContext.pop();

        if (result.isError()) {
            return result;
        }

        boolean returnParams = false;
View Full Code Here

    Result getExpressionResult(Session session) {

        Expression e = expression;             // representing CALL
        Object     o = e.getValue(session);    // expression return value
        Result     r;

        if (o instanceof Result) {
            return (Result) o;
        }

        if (resultMetaData == null) {
            getResultMetaData();
        }

        /**
         * @todo 1.9.0 For table functions implment handling of Result objects
         * returned from Java functions. Review and document instantiation and usage
         * of relevant implementation of Result and JDBCResultSet for returning
         * from Java functions?
         * else if (o instanceof JDBCResultSet) {
         *   return ((JDBCResultSet) o).getResult();
         * }
         */
        r = Result.newSingleColumnResult(resultMetaData);

        Object[] row = new Object[1];

        row[0] = o;

        r.getNavigator().add(row);

        return r;
    }
View Full Code Here

        }
    }

    public Result execute(Session session) {

        Result result = getResult(session);

        if (result.isError()) {
            result.getException().setStatementType(group, type);

            return result;
        }

        try {
View Full Code Here

                    }

                    session.database.schemaManager.addSchemaObject(table);

                    if (statement != null) {
                        Result result = statement.execute(session);

                        table.insertIntoTable(session, result);
                    }

                    return Result.updateZeroResult;
View Full Code Here

    protected void readDDL(Session session) throws IOException {

        for (; readLoggedStatement(session); ) {
            Statement cs     = null;
            Result    result = null;

            if (rowIn.getStatementType() == INSERT_STATEMENT) {
                isInsert = true;

                break;
            }

            try {
                cs = session.compileStatement(statement);
                result = session.executeCompiledStatement(cs,
                        ValuePool.emptyObjectArray);

                if (cs.getType() == StatementTypes.CREATE_SCHEMA) {
                    HsqlName name = cs.getSchemalName();

                    session.setSchema(name.name);
                }
            } catch (HsqlException e) {
                result = Result.newErrorResult(e);
            }

            if (result.isError()) {

                // handle grants on math and library routines in old versions
                if (cs == null) {}
                else {
                    if (cs.getType() == StatementTypes.GRANT) {
                        continue;
                    }
                }

                //
            }

            if (result.isError()) {
                db.logger.appLog.logContext(SimpleLog.LOG_ERROR,
                                            result.getMainString());

                throw Error.error(ErrorCode.ERROR_IN_SCRIPT_FILE,
                                  ErrorCode.M_DatabaseScriptReader_readDDL,
                                  new Object[] {
                    new Integer(lineCount), result.getMainString()
                });
            }
        }
    }
View Full Code Here

     * @return the result of executing the statement
     */
    Result getResult(Session session) {

        Table           table              = baseTable;
        Result          resultOut          = null;
        RowSetNavigator generatedNavigator = null;
        PersistentStore store = session.sessionData.getRowStore(baseTable);

        if (generatedIndexes != null) {
            resultOut = Result.newUpdateCountResult(generatedResultMetaData,
                    0);
            generatedNavigator = resultOut.getChainedResult().getNavigator();
        }

        RowSetNavigator newDataNavigator = queryExpression == null
                                           ? getInsertValuesNavigator(session)
                                           : getInsertSelectNavigator(session);
        Expression        checkCondition = null;
        RangeIteratorBase checkIterator  = null;

        if (targetTable != baseTable) {
            QuerySpecification select =
                ((TableDerived) targetTable).getQueryExpression()
                    .getMainSelect();

            checkCondition = select.checkQueryCondition;

            if (checkCondition != null) {
                checkIterator = select.rangeVariables[0].getIterator(session);
            }
        }

        while (newDataNavigator.hasNext()) {
            Object[] data = newDataNavigator.getNext();

            if (checkCondition != null) {
                checkIterator.currentData = data;

                boolean check = checkCondition.testCondition(session);

                if (!check) {
                    throw Error.error(ErrorCode.X_44000);
                }
            }

            table.insertRow(session, store, data);

            if (generatedNavigator != null) {
                Object[] generatedValues = getGeneratedColumns(data);

                generatedNavigator.add(generatedValues);
            }
        }

        newDataNavigator.beforeFirst();
        table.fireAfterTriggers(session, Trigger.INSERT_AFTER,
                                newDataNavigator);

        if (resultOut == null) {
            resultOut =
                Result.getUpdateCountResult(newDataNavigator.getSize());
        } else {
            resultOut.setUpdateCount(newDataNavigator.getSize());
        }

        return resultOut;
    }
View Full Code Here

        Type[] colTypes  = baseTable.getColumnTypes();
        int[]  columnMap = insertColumnMap;

        //
        Result                result = queryExpression.getResult(session, 0);
        RowSetNavigator       nav         = result.initialiseNavigator();
        Type[]                sourceTypes = result.metaData.columnTypes;
        RowSetNavigatorClient newData     = new RowSetNavigatorClient(2);

        while (nav.hasNext()) {
            Object[] data       = baseTable.getNewRowData(session);
View Full Code Here

        return sb.toString();
    }

    public Result execute(Session session) {

        Result result = getResult(session);

        if (result.isError()) {
            result.getException().setStatementType(group, type);
        }

        return result;
    }
View Full Code Here

     */
    protected void finishStream() throws IOException {}

    protected void writeDDL() throws IOException {

        Result ddlPart = database.getScript(!includeCachedData);

        writeSingleColumnResult(ddlPart);
    }
View Full Code Here

TOP

Related Classes of org.hsqldb_voltpatches.result.Result

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.