Пример #1
0
  /**
   * Finish doing the changes for this index. This is intended for deferred inserts for unique
   * indexes. It has no effect unless we are doing an update of a unique index.
   *
   * @exception StandardException Thrown on error
   */
  public void finish() throws StandardException {
    ExecRow deferredRow;

    /* Deferred processing only necessary for unique indexes */
    if (rowHolder != null) {
      CursorResultSet rs = rowHolder.getResultSet();
      try {
        rs.open();
        while ((deferredRow = rs.getNextRow()) != null) {
          if (SanityManager.DEBUG) {
            if (!(deferredRow instanceof ExecIndexRow)) {
              SanityManager.THROWASSERT(
                  "deferredRow isn't an instance "
                      + "of ExecIndexRow as expected. "
                      + "It is an "
                      + deferredRow.getClass().getName());
            }
          }
          insertAndCheckDups((ExecIndexRow) deferredRow);
        }
      } finally {
        rs.close();

        /*
         ** If row holder was passed in, let the
         ** client of this method clean it up.
         */
        if (!rowHolderPassedIn) {
          rowHolder.close();
        }
      }
    }
  }
Пример #2
0
  /**
   * Insert a row into the temporary conglomerate
   *
   * <p>This opens our deferred ConglomeratController the first time it is called.
   *
   * @exception StandardException Thrown on error
   */
  private void doDeferredInsert() throws StandardException {
    if (rowHolder == null) {
      Properties properties = new Properties();

      // Get the properties on the index
      openIndexCC().getInternalTablePropertySet(properties);

      /*
       ** Create our row holder.  it is ok to skip passing
       ** in the result description because if we don't already
       ** have a row holder, then we are the only user of the
       ** row holder (the description is needed when the row
       ** holder is going to be handed to users for triggers).
       */
      rowHolder = new TemporaryRowHolderImpl(activation, properties, (ResultDescription) null);
    }

    /*
     ** If the user of the IndexChanger already
     ** had a row holder, then we don't need to
     ** bother saving deferred inserts -- they
     ** have already done so.
     */
    if (!rowHolderPassedIn) {
      rowHolder.insert(ourIndexRow);
    }
  }
Пример #3
0
 /**
  * Close this IndexChanger.
  *
  * @exception StandardException Thrown on error
  */
 public void close() throws StandardException {
   closeIndexCC();
   closeIndexSC();
   if (rowHolder != null && !rowHolderPassedIn) {
     rowHolder.close();
   }
   baseCC = null;
 }