Example #1
0
  /** Constructor helper. */
  private void init(DataView view, boolean writeAllowed, CursorConfig config, KeyRange range)
      throws DatabaseException {

    if (config == null) {
      config = view.cursorConfig;
    }
    this.view = view;
    this.writeAllowed = writeAllowed && view.writeAllowed;
    this.range = (range != null) ? range : view.range;
    readUncommitted = config.getReadUncommitted() || view.currentTxn.isReadUncommitted();
    initThangs();

    if (joinCursor == null) {
      cursor = new MyRangeCursor(this.range, config, view, this.writeAllowed);
    }
  }
Example #2
0
  /** Clones a cursor preserving the current position. */
  DataCursor cloneCursor() throws DatabaseException {

    checkNoJoinCursor();

    DataCursor o;
    try {
      o = (DataCursor) super.clone();
    } catch (CloneNotSupportedException neverHappens) {
      return null;
    }

    o.initThangs();
    KeyRange.copy(keyThang, o.keyThang);
    KeyRange.copy(valueThang, o.valueThang);
    if (primaryKeyThang != keyThang) {
      KeyRange.copy(primaryKeyThang, o.primaryKeyThang);
    }

    o.cursor = cursor.dup(true);
    return o;
  }