Package org.apache.derby.iapi.sql.conn

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);
    }

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


    *
   * @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

    cc.setInUse(true);

    // Save off the current isolation level on entry so that it gets restored
    cc.setEntryIsolationLevel( getCurrentIsolationLevel());

    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

    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);
    }
    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);
      }

      inTrigger = parentStatementContext.inTrigger() || (outermostTrigger == parentStatementDepth);
      parentIsAtomic = parentStatementContext.isAtomic();
      statementContext.setSQLAllowed(parentStatementContext.getSQLAllowed(), false);
      if (parentStatementContext.getSystemCode())
        statementContext.setSystemCode();
    }

    incrementStatementDepth();

View Full Code Here

  /**
   * @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

        }

        /* Add the dependency to the StatementContext, so that
         * it can be cleared on a pre-execution error.
         */
        StatementContext sc = (StatementContext) cm.getContext(org.apache.derby.iapi.reference.ContextId.LANG_STATEMENT);
        sc.addDependency(dy);
      }
      else
      {
        /* Add a stored dependency */
        LanguageConnectionContext  lcc = getLanguageConnectionContext(cm);
View Full Code Here

  public void checkCancellationFlag()
        throws
            StandardException
  {
        LanguageConnectionContext lcc = getLanguageConnectionContext();
        StatementContext localStatementContext = lcc.getStatementContext();
        if (localStatementContext == null) {
            return;
        }

    InterruptStatus.throwIf(lcc);

        if (localStatementContext.isCancelled()) {
            throw StandardException.newException(SQLState.LANG_STATEMENT_CANCELLED_OR_TIMED_OUT);
        }
    }
View Full Code Here

                                               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

     *
     * @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

            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

TOP

Related Classes of org.apache.derby.iapi.sql.conn.StatementContext

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.