@Override
 public int[] getModifiedColumns() {
   if (this.updateColsIndex == null
       && (this.type == Type.AFTER_UPDATE || this.type == Type.BEFORE_UPDATE)) {
     final SerializableDelta delta = getSerializableDelta();
     final FormatableBitSet fbs = delta.getChangedColumns();
     final int numChangedColumns = fbs.getNumBitsSet();
     this.updateColsIndex = new int[numChangedColumns];
     int index = 0;
     for (int colIndex = fbs.anySetBit();
         colIndex >= 0;
         colIndex = fbs.anySetBit(colIndex), ++index) {
       this.updateColsIndex[index] = colIndex + 1;
     }
   }
   return this.updateColsIndex;
 }
예제 #2
0
  // this test test the rowSource over head.
  // when param set to 1, also gets the overhead for writeExternal for Storables
  protected void SF002(int param) throws StandardException, T_Fail {

    T_RowSource rowSource = new T_RowSource(500000, 13, 2, false, null);

    DynamicByteArrayOutputStream out = new DynamicByteArrayOutputStream(16384);
    FormatIdOutputStream logicalDataOut = new FormatIdOutputStream(out);

    long startms = System.currentTimeMillis();
    System.out.println("starting rowSource test, time: " + startms);
    try {

      FormatableBitSet validColumns = rowSource.getValidColumns();

      int numberFields = 0;
      if (validColumns != null) {
        for (int i = validColumns.getLength() - 1; i >= 0; i--) {
          if (validColumns.get(i)) {
            numberFields = i + 1;
            break;
          }
        }
      }

      DataValueDescriptor[] row = rowSource.getNextRowFromRowSource().getRowArray();
      while (row != null) {
        if (SanityManager.DEBUG) {
          SanityManager.ASSERT(row != null, "RowSource returned null");
        }

        int arrayPosition = -1;
        for (int i = 0; i < numberFields; i++) {
          // write each column out
          if (validColumns.get(i)) {
            arrayPosition++;
            DataValueDescriptor column = row[arrayPosition];

            if (param == 1) {
              try {
                Storable sColumn = (Storable) column;
                if (!sColumn.isNull()) {
                  sColumn.writeExternal(logicalDataOut);
                  out.reset();
                }
              } catch (IOException ioe) {
                throw T_Fail.exceptionFail(ioe);
              }
            }
          }
        }

        row = rowSource.getNextRowFromRowSource().getRowArray();
      }

    } finally {

    }

    long endms = System.currentTimeMillis();
    long time2 = endms - startms;
    if (param != 1)
      System.out.println("ended rowSource test, time: " + endms + ", time spent = " + time2);
    else
      System.out.println(
          "------ writeExternal called....\n ended rowSource test, time: "
              + endms
              + ", time spent = "
              + time2);

    PASS("SF002");
  }