Exemple #1
0
 public Sequence openSequence__wrappee__base(
     Transaction txn, DatabaseEntry key, SequenceConfig config) throws DatabaseException {
   checkEnv();
   DatabaseUtil.checkForNullDbt(key, "key", true);
   checkRequiredDbState(OPEN, "Can't call Database.openSequence:");
   checkWritable("openSequence");
   this.hook45(txn, key);
   return new Sequence(this, txn, key, config);
 }
Exemple #2
0
  /** Javadoc for this public method is generated via the doc templates in the doc_src directory. */
  public Sequence openSequence(Transaction txn, DatabaseEntry key, SequenceConfig config)
      throws DatabaseException {

    checkEnv();
    DatabaseUtil.checkForNullDbt(key, "key", true);
    checkRequiredDbState(OPEN, "Can't call Database.openSequence:");
    checkWritable("openSequence");
    trace(Level.FINEST, "Database.openSequence", txn, key, null, null);

    return new Sequence(this, txn, key, config);
  }
Exemple #3
0
 public OperationStatus putNoDupData__wrappee__base(
     Transaction txn, DatabaseEntry key, DatabaseEntry data) throws DatabaseException {
   checkEnv();
   DatabaseUtil.checkForNullDbt(key, "key", true);
   DatabaseUtil.checkForNullDbt(data, "data", true);
   DatabaseUtil.checkForPartialKey(key);
   checkRequiredDbState(OPEN, "Can't call Database.putNoDupData");
   checkWritable("putNoDupData");
   this.hook52(txn, key, data);
   return putInternal(txn, key, data, PutMode.NODUP);
 }
Exemple #4
0
  public OperationStatus putNoOverwrite(Transaction txn, DatabaseEntry key, DatabaseEntry data)
      throws DatabaseException {

    checkEnv();
    DatabaseUtil.checkForNullDbt(key, "key", true);
    DatabaseUtil.checkForNullDbt(data, "data", true);
    DatabaseUtil.checkForPartialKey(key);
    checkRequiredDbState(OPEN, "Can't call Database.putNoOverWrite");
    checkWritable("putNoOverwrite");
    trace(Level.FINEST, "Database.putNoOverwrite", txn, key, data, null);

    return putInternal(txn, key, data, PutMode.NOOVERWRITE);
  }
Exemple #5
0
  /**
   * @deprecated It has not been possible to implement this method with correct transactional
   *     semantics without incurring a performance penalty on all Database operations. Truncate
   *     functionality has been moved to Environment.truncateDatabase(), which requires that all
   *     Database handles on the database are closed before the truncate operation can execute.
   */
  public int truncate(Transaction txn, boolean countRecords) throws DatabaseException {

    checkEnv();
    checkRequiredDbState(OPEN, "Can't call Database.truncate");
    checkWritable("truncate");
    Tracer.trace(
        Level.FINEST,
        envHandle.getEnvironmentImpl(),
        "Database.truncate" + ": txnId=" + ((txn == null) ? "null" : Long.toString(txn.getId())));

    Locker locker = null;
    boolean triggerLock = false;
    boolean operationOk = false;

    try {
      locker =
          LockerFactory.getWritableLocker(
              envHandle, txn, isTransactional(), true /*retainLocks*/, null);

      /*
       * Pass true to always get a read lock on the triggers, so we are
       * sure that no secondaries are added during truncation.
       */
      acquireTriggerListReadLock();
      triggerLock = true;

      /* Truncate primary. */
      int count = truncateInternal(locker, countRecords);

      /* Truncate secondaries. */
      for (int i = 0; i < triggerList.size(); i += 1) {
        Object obj = triggerList.get(i);
        if (obj instanceof SecondaryTrigger) {
          SecondaryDatabase secDb = ((SecondaryTrigger) obj).getDb();
          secDb.truncateInternal(locker, false);
        }
      }

      operationOk = true;
      return count;
    } finally {
      if (locker != null) {
        locker.operationEnd(operationOk);
      }
      if (triggerLock) {
        releaseTriggerListReadLock();
      }
    }
  }
Exemple #6
0
 public OperationStatus delete__wrappee__base(Transaction txn, DatabaseEntry key)
     throws DatabaseException {
   checkEnv();
   DatabaseUtil.checkForNullDbt(key, "key", true);
   checkRequiredDbState(OPEN, "Can't call Database.delete:");
   checkWritable("delete");
   this.hook47(txn, key);
   OperationStatus commitStatus = OperationStatus.NOTFOUND;
   Locker locker = null;
   try {
     locker = LockerFactory.getWritableLocker(envHandle, txn, isTransactional());
     commitStatus = deleteInternal(locker, key);
     return commitStatus;
   } finally {
     if (locker != null) {
       locker.operationEnd(commitStatus);
     }
   }
 }