Package com.sleepycat.db

Examples of com.sleepycat.db.OperationStatus


        Cursor cursor = null;
        int nWritten = 0;
        try {
            cursor = db.openCursor(txn, cursorConfig);
            OperationStatus status = cursor.getFirst(key, data, null);
            while (status == OperationStatus.SUCCESS) {
                boolean oneWritten = false;
                if (evolveNeeded(key, data, binding)) {
                    cursor.putCurrent(data);
                    oneWritten = true;
View Full Code Here


        throws DatabaseException {

        Data catalogData;
        DatabaseEntry key = new DatabaseEntry(DATA_KEY);
        DatabaseEntry data = new DatabaseEntry();
        OperationStatus status = db.get(txn, key, data, null);
        if (status == OperationStatus.SUCCESS) {
            ByteArrayInputStream bais = new ByteArrayInputStream
                (data.getData(), data.getOffset(), data.getSize());
            try {
                ObjectInputStream ois = new ObjectInputStream(bais);
View Full Code Here

        DatabaseEntry keyEntry = new DatabaseEntry();
        DatabaseEntry pkeyEntry = new DatabaseEntry();
        keyBinding.objectToEntry(key, keyEntry);

        OperationStatus status = db.get(txn, keyEntry, pkeyEntry, lockMode);

        if (status == OperationStatus.SUCCESS) {
            return (PK) pkeyBinding.entryToObject(pkeyEntry);
        } else {
            return null;
View Full Code Here

        DatabaseEntry key = new DatabaseEntry(LAST_CLASS_ID_KEY);
        DatabaseEntry data = new DatabaseEntry();
        if (dbConfig.getReadOnly()) {
            /* Check that the class ID record exists. */
            OperationStatus status = db.get(null, key, data, null);
            if (status != OperationStatus.SUCCESS) {
                throw new IllegalStateException
                    ("A read-only catalog database may not be empty");
            }
        } else {
View Full Code Here

            System.arraycopy(classID, 0, keyBytes, 1, classID.length);
            DatabaseEntry key = new DatabaseEntry(keyBytes);

            /* Read the class format. */

            OperationStatus status = db.get(null, key, data, LockMode.DEFAULT);
            if (status != OperationStatus.SUCCESS) {
                throw new ClassNotFoundException("Catalog class ID not found");
            }
            try {
                ObjectInputStream ois =
View Full Code Here

            UtfOps.charsToBytes(nameChars, 0, keyBytes, 1, nameChars.length);
            DatabaseEntry key = new DatabaseEntry(keyBytes);

            /* Read class info.  */
            DatabaseEntry data = new DatabaseEntry();
            OperationStatus status = db.get(null, key, data, LockMode.DEFAULT);
            if (status != OperationStatus.SUCCESS) {
                /*
                 * Not found in the database, write class info and class
                 * format.
                 */
 
View Full Code Here

            cursor = db.openCursor(txn, cursorConfig);

            /* Get the current class ID. */
            DatabaseEntry key = new DatabaseEntry(LAST_CLASS_ID_KEY);
            DatabaseEntry data = new DatabaseEntry();
            OperationStatus status = cursor.getSearchKey(key, data,
                                                         writeLockMode);
            if (status != OperationStatus.SUCCESS) {
                throw new IllegalStateException("Class ID not initialized");
            }
            byte[] idBytes = getBytes(data);
View Full Code Here

    /** {@inheritDoc} */
    public byte[] get(DbTransaction txn, byte[] key, boolean forUpdate) {
  try {
      DatabaseEntry valueEntry = new DatabaseEntry();
      OperationStatus status = db.get(
    BdbTransaction.getBdbTxn(txn), new DatabaseEntry(key),
    valueEntry, forUpdate ? LockMode.RMW : null);
      if (status == SUCCESS) {
    return convertData(valueEntry.getData());
      } else if (status == NOTFOUND) {
View Full Code Here

    public void markForUpdate(DbTransaction txn, byte[] key) {
  try {
      DatabaseEntry valueEntry = new DatabaseEntry();
      /* Ignore value by truncating to zero bytes */
      valueEntry.setPartial(0, 0, true);
      OperationStatus status = db.get(
    BdbTransaction.getBdbTxn(txn), new DatabaseEntry(key),
    valueEntry, LockMode.RMW);
      if (status != SUCCESS && status != NOTFOUND) {
    throw new DbDatabaseException("Operation failed: " + status);
      }
View Full Code Here

    }

    /** {@inheritDoc} */
    public void put(DbTransaction txn, byte[] key, byte[] value) {
  try {
      OperationStatus status = db.put(
    BdbTransaction.getBdbTxn(txn), new DatabaseEntry(key),
    new DatabaseEntry(value));
      if (status != SUCCESS) {
    throw new DbDatabaseException("Operation failed: " + status);
      }
View Full Code Here

TOP

Related Classes of com.sleepycat.db.OperationStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.