Examples of StatementContext


Examples of org.apache.derby.iapi.sql.conn.StatementContext

                                               boolean sync,
                                               int commitflag,
                                               boolean requestedByUser)
         throws StandardException
    {
        StatementContext statementContext = getStatementContext();

        if (requestedByUser  &&
            (statementContext != null) &&
            statementContext.inUse() &&
            statementContext.isAtomic())
        {
            throw StandardException.newException(
                    SQLState.LANG_NO_COMMIT_IN_NESTED_CONNECTION);
        }
View Full Code Here

Examples of org.apache.derby.iapi.sql.conn.StatementContext

     *
     * @exception StandardException thrown on failure
     */
    private void doRollback(boolean xa, boolean requestedByUser) throws StandardException
    {
        StatementContext statementContext = getStatementContext();
        if (requestedByUser &&
            (statementContext != null) &&
            statementContext.inUse() &&
            statementContext.isAtomic())
        {
            throw StandardException.newException(SQLState.LANG_NO_ROLLBACK_IN_NESTED_CONNECTION);
        }

        // Log rollback to error log, if appropriate
View Full Code Here

Examples of org.apache.derby.iapi.sql.conn.StatementContext

            cc.resetContext();
        }

        cc.setInUse(true);

        StatementContext sc = getStatementContext();
        if (sc.getSystemCode())
            cc.setReliability(CompilerContext.INTERNAL_SQL_LEGAL);

        /*
         * Set the compilation schema when its UUID is available.
         * i.e.:  Schema may not have been physically created yet, so
View Full Code Here

Examples of org.apache.derby.iapi.sql.conn.StatementContext

        int                 parentStatementDepth = statementDepth;
        boolean             inTrigger = false;
        boolean             parentIsAtomic = false;

        // by default, assume we are going to use the outermost statement context
        StatementContext    statementContext = statementContexts[0];

        /*
        ** If we haven't allocated any statement contexts yet, allocate
        ** the outermost stmt context now and push it.
        */

        if (statementContext == null)
        {
            statementContext = statementContexts[0] = new GenericStatementContext(this);
            statementContext.
                setSQLSessionContext(getTopLevelSQLSessionContext());
        }
        else if (statementDepth > 0)
        {
            StatementContext    parentStatementContext;
            /*
            ** We also cache a 2nd statement context, though we still
            ** push and pop it. Note, new contexts are automatically pushed.
            */
            if (statementDepth == 1)
            {
                statementContext = statementContexts[1];

                if (statementContext == null)
                    statementContext = statementContexts[1] = new GenericStatementContext(this);
                else
                    statementContext.pushMe();

                parentStatementContext = statementContexts[0];
            }
            else
            {
                parentStatementContext = getStatementContext();
                statementContext = new GenericStatementContext(this);
            }

            statementContext.setSQLSessionContext(
                parentStatementContext.getSQLSessionContext());

            inTrigger = parentStatementContext.inTrigger() || (outermostTrigger == parentStatementDepth);
            parentIsAtomic = parentStatementContext.isAtomic();
            statementContext.setSQLAllowed(parentStatementContext.getSQLAllowed(), false);
            if (parentStatementContext.getSystemCode())
                statementContext.setSystemCode();
        } else {
            statementContext.
                setSQLSessionContext(getTopLevelSQLSessionContext());
        }
View Full Code Here

Examples of org.apache.derby.iapi.sql.conn.StatementContext

    /**
     * @see LanguageConnectionContext#setIsolationLevel
     */
    public void setIsolationLevel(int isolationLevel) throws StandardException
    {
        StatementContext stmtCtxt = getStatementContext();
        if (stmtCtxt!= null && stmtCtxt.inTrigger())
            throw StandardException.newException(SQLState.LANG_NO_XACT_IN_TRIGGER, getTriggerExecutionContext().toString());

        // find if there are any held cursors from previous isolation level.
        // if yes, then throw an exception that isolation change not allowed until
        // the held cursors are closed.
View Full Code Here

Examples of org.apache.derby.iapi.sql.conn.StatementContext

    /**
     * Return the current SQL session context based on statement context
     */
    private SQLSessionContext getCurrentSQLSessionContext() {
        StatementContext ctx = getStatementContext();
        SQLSessionContext curr;

        if (ctx == null || !ctx.inUse()) {
            curr = getTopLevelSQLSessionContext();
        } else {
            // We are inside a nested connection in a procedure of
            // function.
            curr = ctx.getSQLSessionContext();

            if (SanityManager.DEBUG) {
                SanityManager.ASSERT(
                    curr != null,
                    "SQL session context should never be empty here");
View Full Code Here

Examples of org.apache.derby.iapi.sql.conn.StatementContext

            // default schema is implementation defined. In Derby we
            // inherit it when we invoke stored procedures and functions.
            sc.setDefaultSchema(getDefaultSchema(a));
        }

        StatementContext stmctx = getStatementContext();

        // Since the statement is an invocation (iff push=true), it will now be
        // associated with the pushed SQLSessionContext (and no longer just
        // share that of its caller (or top).  The statement contexts of nested
        // connection statements will inherit statement context so the SQL
        // session context is available through it when nested statements are
        // compiled (and executed, for the most part).  However, for dynamic
        // result sets, the relevant statement context (originating result set)
        // is no longer available for execution time references to the SQL
        // session context, so we rely on the activation of the caller for
        // accessing it, cf. e.g. overload variants of
        // getDefaultSchema/setDefaultSchema.  If such nested connections
        // themselves turn out to be invocations, they in turn get a new
        // SQLSessionContext associated with them etc.
        stmctx.setSQLSessionContext(sc);
    }
View Full Code Here

Examples of org.apache.derby.iapi.sql.conn.StatementContext

      // method of the GenericTriggerExecutor class, and at that time
      // the SPS action will be recompiled correctly.
        rePrepare(lccToUse);
      }

      StatementContext statementContext = lccToUse.pushStatementContext(
        isAtomic, updateMode==CursorNode.READ_ONLY, getSource(), pvs, rollbackParentContext, timeoutMillis);

      if (needsSavepoint())
      {
        /* Mark this position in the log so that a statement
        * rollback will undo any changes.
        */
        statementContext.setSavePoint();
        needToClearSavePoint = true;
      }

      if (executionConstants != null)
      {
        lccToUse.validateStmtExecution(executionConstants);
      }

      ResultSet resultSet = null;
      try {
 
        resultSet = activation.execute();

        resultSet.open();
      } catch (StandardException se) {
        /* Cann't handle recompiling SPS action recompile here */
        if (!se.getMessageId().equals(SQLState.LANG_STATEMENT_NEEDS_RECOMPILE)
             || spsAction)
          throw se;
        statementContext.cleanupOnError(se);
        continue recompileOutOfDatePlan;

      }


      if (needToClearSavePoint)
      {
        /* We're done with our updates */
        statementContext.clearSavePoint();
      }

      lccToUse.popStatementContext(statementContext, null);         

      if (activation.isSingleExecution() && resultSet.isClosed())
View Full Code Here

Examples of org.apache.derby.iapi.sql.conn.StatementContext

    long        bindTime = 0;
    long        optimizeTime = 0;
    long        generateTime = 0;
    Timestamp      beginTimestamp = null;
    Timestamp      endTimestamp = null;
    StatementContext  statementContext = null;

    // verify it isn't already prepared...
    // if it is, and is valid, simply return that tree.
    // if it is invalid, we will recompile now.
    if (preparedStmt != null) {
View Full Code Here

Examples of org.apache.derby.iapi.sql.conn.StatementContext

     * LanguageConnectionContext.
     */
    beginTime = getCurrentTimeMillis();
    beginExecutionTime = beginTime;

    StatementContext sc = lcc.getStatementContext();
    sc.setTopResultSet(this, (NoPutResultSet[]) null);

    // Pick up any materialized subqueries
    if (subqueryTrackingArray == null)
    {
      subqueryTrackingArray = sc.getSubqueryTrackingArray();
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.