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

    return  cc;
  }
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, tran);
    }
    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, tran);
        else
          statementContext.pushMe();

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

      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

     * 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

    if ((conn == null) || conn.isClosed())
      throw Util.noCurrentConnection();

    if (!internal) {
      StatementContext sc = conn.getLanguageConnection().getStatementContext();
      if ((sc == null) || (sc.getSQLAllowed() < org.apache.derby.catalog.types.RoutineAliasInfo.MODIFIES_SQL_DATA))
        throw Util.noCurrentConnection();
    }

    return conn.getLocalDriver().getNewNestedConnection(conn);
  }
View Full Code Here

        /* Push and pop a StatementContext around a next call
         * so that the ResultSet will get correctly closed down
         * on an error.
         * (Cache the LanguageConnectionContext)
         */
                StatementContext statementContext =
                    lcc.pushStatementContext(isAtomic,
               concurrencyOfThisResultSet==JDBC20Translation.CONCUR_READ_ONLY,
               getSQLText(),
               getParameterValueSet(),
                                             false, timeoutMillis);
View Full Code Here

  public void insertRow() throws SQLException {
        synchronized (getConnectionSynchronization()) {
            checksBeforeInsert();
            setupContextStack();
            LanguageConnectionContext lcc = getEmbedConnection().getLanguageConnection();
            StatementContext statementContext = null;
            try {
                /*
                 * construct the insert statement
                 *
                 * If no values have been supplied for a column, it will be set
View Full Code Here

        // Check that the cursor is not positioned on insertRow
        checkNotOnInsertRow();
       
        setupContextStack();
        LanguageConnectionContext lcc = getEmbedConnection().getLanguageConnection();
        StatementContext statementContext = null;
        try {
            if (currentRowHasBeenUpdated == false) //nothing got updated on this row
                return; //nothing to do since no updates were made to this row

            //now construct the update where current of sql
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.