Package org.apache.derby.iapi.sql

Examples of org.apache.derby.iapi.sql.Activation


                           GeneratedMethod checkGM,
                           int constantActionItem,
                           int rsdItem)
      throws StandardException
  {
    Activation activation = source.getActivation();
    getAuthorizer(activation).authorize(activation, Authorizer.SQL_WRITE_OP);
    return new UpdateResultSet(source, checkGM, activation,
                   constantActionItem, rsdItem);
  }
View Full Code Here


        // closing one or more activation leaving our index beyond
        // the end of the array
        if (i >= acts.size())
          continue;

        Activation a1 = (Activation) acts.get(i);
        if (!a1.isInUse()) {
          a1.close();
        }
      }
    }

    if (SanityManager.DEBUG) {
View Full Code Here

    int size = acts.size();
    if (size > 0)
    {
      for (int i = 0; i < size; i++) {
         Activation a = (Activation) acts.get(i);

         if (!a.isInUse())
         {
          continue;
         }



        String executingCursorName = a.getCursorName();

         if (cursorName.equals(executingCursorName)) {

          ResultSet rs = a.getResultSet();
          if (rs == null)
            continue;

           // if the result set is closed, the the cursor doesn't exist
           if (rs.isClosed()) {         
View Full Code Here

   */
  private boolean checkIfAnyActivationHasHoldCursor(String tableName)
      throws StandardException
  {
    for (int i = acts.size() - 1; i >= 0; i--) {
      Activation a = (Activation) acts.get(i);
      if (a.checkIfThisActivationHasHoldCursor(tableName))
        return true;
    }
    return false;
  }
View Full Code Here

    boolean seenOpenResultSets = false;

    /* For every activation */
    for (int i = acts.size() - 1; i >= 0; i--) {

      Activation a = (Activation) acts.get(i);

      if (SanityManager.DEBUG)
      {
        SanityManager.ASSERT(a instanceof CursorActivation, "a is not a CursorActivation");
      }

      if (!a.isInUse())
      {
        continue;
      }

      if (!a.getResultSetHoldability())
      {
        continue;
      }

      ResultSet rs = ((CursorActivation) a).getResultSet();

      /* is there an open result set? */
      if ((rs != null) && !rs.isClosed() && rs.returnsRows())
      {
        seenOpenResultSets = true;
        break;
      }
    }

    if (!seenOpenResultSets)
      return(true);

    // There may be open ResultSet's that are yet to be garbage collected
    // let's try and force these out rather than throw an error
    System.gc();
    System.runFinalization();


    /* For every activation */
    for (int i = acts.size() - 1; i >= 0; i--) {
       
      Activation a = (Activation) acts.get(i);

      if (SanityManager.DEBUG)
      {
        SanityManager.ASSERT(a instanceof CursorActivation, "a is not a CursorActivation");
      }

      if (!a.isInUse())
      {
        continue;
      }

      if (!a.getResultSetHoldability())
      {
        continue;
      }

      ResultSet rs = ((CursorActivation) a).getResultSet();
View Full Code Here

    // synchronize on acts as other threads may be closing activations
    // in this list, thus invalidating the Enumeration
    for (int i = acts.size() - 1; i >= 0; i--) {
       
      Activation a = (Activation) acts.get(i);

      if (!a.isInUse())
      {
        continue;
      }
     
      /* for this prepared statement */
      if (pStmt == a.getPreparedStatement()) {
        ResultSet rs = a.getResultSet();

        /* is there an open result set? */
        if (rs != null && ! rs.isClosed())
        {
          if (!rs.returnsRows())
            continue;
          seenOpenResultSets = true;
          break;
        }
       
      }
    }

    if (!seenOpenResultSets)
      return false;

    // There may be open ResultSet's that are yet to be garbage collected
    // let's try and force these out rather than throw an error
    System.gc();
    System.runFinalization();


    /* For every activation */
    // synchronize on acts as other threads may be closing activations
    // in this list, thus invalidating the Enumeration
    for (int i = acts.size() - 1; i >= 0; i--) {
       
      Activation a = (Activation) acts.get(i);

      if (!a.isInUse())
      {
        continue;
      }

      /* for this prepared statement */
      if (pStmt == a.getPreparedStatement()) {
        ResultSet rs = a.getResultSet();

        /* is there an open result set? */
        if (rs != null && ! rs.isClosed())
        {
          if ((provider != null) && rs.returnsRows()) {
View Full Code Here

        // it maybe the case that a reset()/close() ends up closing
        // one or more activation leaving our index beyond
        // the end of the array
        if (i >= acts.size())
          continue;
        Activation a = (Activation) acts.get(i);
        a.reset();
        a.close();
      }
                      
      popMe();
    }
View Full Code Here

      // one or more activation leaving our index beyond
      // the end of the array
      if (i >= acts.size())
        continue;

      Activation a = (Activation) acts.get(i);
      /*
      ** andClose true means we are here for rollback.
      ** In case of rollback, we don't care for holding
      ** cursors and that's why I am resetting holdability
      ** to false for all activations just before rollback
      */ 
      if (andClose)
        a.setResultSetHoldability(false);

      /*
      ** Look for stale activations.  Activations are
      ** marked as unused during statement finalization.
      ** Here, we sweep and remove this inactive ones.
      */ 
      if (!a.isInUse())
      {
        a.close();
        continue;
      }

      a.reset();

      // Only invalidate statements if we performed DDL.
      if (andClose && dataDictionaryInWriteMode()) {
        ExecPreparedStatement ps = a.getPreparedStatement();
        if (ps != null) {
          ps.makeInvalid(DependencyManager.ROLLBACK, this);
        }
      }
    }
View Full Code Here

   * @return CursorNode  The associated CursorNode.
   *
   */
  ExecPreparedStatement getCursorStatement()
  {
    Activation activation = getLanguageConnectionContext().lookupCursorActivation(cursorName);

    if (activation == null)
      return null;

    return activation.getPreparedStatement();
  }
View Full Code Here

                        null,
                        false,
                        0L);
                org.apache.derby.iapi.sql.PreparedStatement ps =
                        lcc.prepareInternalStatement(insertSQL.toString());
                Activation act = ps.getActivation(lcc, false);

                statementContext.setActivation(act);

                // in this for loop we are assigning values for parameters
                //in sql constructed earlier VALUES (?, ..)
                for (int i=1, paramPosition=0; i<=rd.getColumnCount(); i++) {
                    // if the column got updated, do following
                    if (columnGotUpdated[i-1]) { 
                        act.getParameterValueSet().
                                getParameterForSet(paramPosition++).
                                setValue(updateRow.getColumn(i));
                    }
                }
                // Don't see any timeout when inserting rows (use 0)
                //execute the insert
                org.apache.derby.iapi.sql.ResultSet rs =
          ps.executeSubStatement(activation, act, true, 0L);
                act.close();

                lcc.popStatementContext(statementContext, null);
            } catch (Throwable t) {
                throw closeOnTransactionError(t);
            } finally {
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.Activation

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.