Ejemplo n.º 1
0
 public synchronized Cursor openCursor__wrappee__base(Transaction txn, CursorConfig cursorConfig)
     throws DatabaseException {
   checkEnv();
   checkRequiredDbState(OPEN, "Can't open a cursor");
   CursorConfig useConfig = (cursorConfig == null) ? CursorConfig.DEFAULT : cursorConfig;
   if (useConfig.getReadUncommitted() && useConfig.getReadCommitted()) {
     throw new IllegalArgumentException(
         "Only one may be specified: ReadCommitted or ReadUncommitted");
   }
   this.hook46(txn, cursorConfig);
   Cursor ret = newDbcInstance(txn, useConfig);
   return ret;
 }
  /**
   * Obtain a cursor on a database, returning a <code>SecondaryCursor</code>. Calling this method is
   * the equivalent of calling {@link #openCursor} and casting the result to {@link
   * SecondaryCursor}.
   *
   * <p>
   *
   * @param txn To use a cursor for writing to a transactional database, an explicit transaction
   *     must be specified. For read-only access to a transactional database, the transaction may be
   *     null. For a non-transactional database, the transaction must be null.
   *     <p>To transaction-protect cursor operations, cursors must be opened and closed within the
   *     context of a transaction, and the txn parameter specifies the transaction context in which
   *     the cursor will be used.
   *     <p>
   * @param config The cursor attributes. If null, default attributes are used.
   *     <p>
   * @return A secondary database cursor.
   *     <p>
   * @throws DatabaseException if a failure occurs.
   */
  public SecondaryCursor openSecondaryCursor(final Transaction txn, final CursorConfig config)
      throws DatabaseException {

    return new SecondaryCursor(
        this,
        CursorConfig.checkNull(config).openCursor(db, (txn == null) ? null : txn.txn),
        config);
  }