Package org.apache.derby.iapi.sql.execute

Examples of org.apache.derby.iapi.sql.execute.ExecPreparedStatement


                    //the call to java procedure because that activation
                    //is still being used.
                    a.reset();
                // Only invalidate statements if we performed DDL.
                if (dataDictionaryInWriteMode()) {
                    ExecPreparedStatement ps = a.getPreparedStatement();
                    if (ps != null) {
                        ps.makeInvalid(DependencyManager.ROLLBACK, this);
                    }
                }
            } else {
                //We are dealing with commit here.
                if (resultsetReturnsRows){
View Full Code Here


      if (SanityManager.DEBUG)
      {
        SanityManager.ASSERT(currentOfNode != null, "currentOfNode is null");
      }

      ExecPreparedStatement   cursorStmt = currentOfNode.getCursorStatement();
      String[] ucl = cursorStmt.getUpdateColumns();

      /*
      ** If there is no update column list, we need to build
      ** out the result column list to have all columns.
      */
 
View Full Code Here

     * in this query.
     * @return true if the row counts should be checked, false otherwise
     */
  protected boolean shouldWeCheckRowCounts() throws StandardException
  {
        final ExecPreparedStatement ps = getPreparedStatement();

    /*
    ** Check the row count only every N executions.  OK to check this
    ** without synchronization, since the value of this number is not
    ** critical.  The value of N is determined by the property
    ** derby.language.stalePlanCheckInterval.
    */
        int executionCount = ps.incrementExecutionCount();

    /*
    ** Always check row counts the first time, to establish the
    ** row counts for each result set.  After that, don't check
    ** if the execution count is below the minimum row count check
    ** interval.  This saves us from checking a database property
    ** when we don't have to (checking involves querying the store,
    ** which can be expensive).
    */

    if (executionCount == 1)
    {
            return true;
    }
    else if (executionCount <
                Property.MIN_LANGUAGE_STALE_PLAN_CHECK_INTERVAL)
    {
            return false;
    }
    else
    {
            int stalePlanCheckInterval = ps.getStalePlanCheckInterval();

      /*
      ** Only query the database property once.  We can tell because
      ** the minimum value of the property is greater than zero.
      */
      if (stalePlanCheckInterval == 0)
      {
        TransactionController tc = getTransactionController();

        stalePlanCheckInterval =
            PropertyUtil.getServiceInt(
              tc,
              Property.LANGUAGE_STALE_PLAN_CHECK_INTERVAL,
              Property.MIN_LANGUAGE_STALE_PLAN_CHECK_INTERVAL,
              Integer.MAX_VALUE,
              Property.DEFAULT_LANGUAGE_STALE_PLAN_CHECK_INTERVAL
              );

                ps.setStalePlanCheckInterval(stalePlanCheckInterval);
      }

            return (executionCount % stalePlanCheckInterval) == 1;

    }
View Full Code Here

     * @throws StandardException
     */
  protected void checkPositionedStatement(String cursorName, String psName)
    throws StandardException {

    ExecPreparedStatement ps = getPreparedStatement();
    if (ps == null)
      return;
     
    LanguageConnectionContext lcc = getLanguageConnectionContext();

    CursorActivation cursorActivation = lcc.lookupCursorActivation(cursorName);

    if (cursorActivation != null)
    {
      // check we are compiled against the correct cursor
      if (!psName.equals(cursorActivation.getPreparedStatement().getObjectName())) {

        // our prepared statement is now invalid since there
        // exists another cursor with the same name but a different
        // statement.
        ps.makeInvalid(DependencyManager.CHANGED_CURSOR, lcc);
      }
    }
  }
View Full Code Here

    this.isInSortedOrder = isInSortedOrder;
        source = s;
        originalSource = s;
    this.maxRowSize = maxRowSize;

        ExecPreparedStatement ps = a.getPreparedStatement();

    sortTemplateRow = ((ExecRowBuilder) ps.getSavedObject(ra))
                                .build(a.getExecutionFactory());

    order = (ColumnOrdering[])
          ((FormatableArrayHolder) ps.getSavedObject(orderingItem))
          .getArray(ColumnOrdering.class);

    /* NOTE: We need to save order to another variable
     * in the constructor and reset it on every open.
     * This is important because order can get reset in the
View Full Code Here

  {
    checkExecStatus();
    synchronized (getConnectionSynchronization())
    {
      //reason for casting is getActivationClass is not available on PreparedStatement
      ExecPreparedStatement execp = (ExecPreparedStatement)preparedStatement;

      setupContextStack(); // make sure there's context

      try {
        //bug 4579 - if the statement is invalid, regenerate the metadata info
        if (preparedStatement.isValid() == false)
        {
          //need to revalidate the statement here, otherwise getResultDescription would
          //still have info from previous valid statement
          preparedStatement.rePrepare(lcc);
          rMetaData = null;
        }
        //bug 4579 - gcDuringGetMetaData will be null if this is the first time
        //getMetaData call is made.
        //Second check - if the statement was revalidated since last getMetaData call,
        //then gcDuringGetMetaData wouldn't match with current generated class name
        if (gcDuringGetMetaData == null || gcDuringGetMetaData.equals(execp.getActivationClass().getName()) == false)
        {
          rMetaData = null;
          gcDuringGetMetaData = execp.getActivationClass().getName();
        }
        if (rMetaData == null)
        {
          ResultDescription resd = preparedStatement.getResultDescription();
          if (resd != null)
View Full Code Here

      if (SanityManager.DEBUG)
      {
        SanityManager.ASSERT(currentOfNode != null, "currentOfNode is null");
      }

      ExecPreparedStatement   cursorStmt = currentOfNode.getCursorStatement();
      String[] ucl = cursorStmt.getUpdateColumns();

      /*
      ** If there is no update column list, we need to build
      ** out the result column list to have all columns.
      */
 
View Full Code Here

    String          uuidStr = null
    String          suuidStr = null// schema 
    String          compUuidStr = null// compilation schema 
    String          text = null;
    String          usingText = null;
    ExecPreparedStatement  preparedStatement = null;
    String          typeStr = null;
    boolean          valid = true;
    Timestamp        time = null;
    boolean          initiallyCompilable = true;
View Full Code Here

    String            suuidStr;  // schema
    String            typeStr;
    char            type;
    boolean            valid;
    Timestamp          time = null;
    ExecPreparedStatement    preparedStatement = null;
    boolean            initiallyCompilable;
    DataDescriptorGenerator    ddg = dd.getDataDescriptorGenerator();

    if (SanityManager.DEBUG)
    {
View Full Code Here

      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

TOP

Related Classes of org.apache.derby.iapi.sql.execute.ExecPreparedStatement

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.