com.sleepycat.je.Cursor.getSearchBoth()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(160)

本文整理了Java中com.sleepycat.je.Cursor.getSearchBoth()方法的一些代码示例,展示了Cursor.getSearchBoth()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cursor.getSearchBoth()方法的具体详情如下:
包路径:com.sleepycat.je.Cursor
类名称:Cursor
方法名:getSearchBoth

Cursor.getSearchBoth介绍

[英]Moves the cursor to the specified key/data pair, where both the key and data items must match.

Calling this method is equivalent to calling #get(DatabaseEntry,DatabaseEntry,Get,ReadOptions) with Get#SEARCH_BOTH.
[中]将光标移动到指定的键/数据对,其中键和数据项必须匹配。
调用此方法相当于使用get和SEARCH调用#get(DatabaseEntry、DatabaseEntry、get、ReadOptions)。

代码示例

代码示例来源:origin: opensourceBIM/BIMserver

@Override
public void delete(String indexTableName, byte[] featureBytesOldIndex, byte[] array, DatabaseSession databaseSession) throws BimserverLockConflictException {
  try {
    TableWrapper tableWrapper = getTableWrapper(indexTableName);
    Cursor cursor = tableWrapper.getDatabase().openCursor(getTransaction(databaseSession, tableWrapper), getCursorConfig(tableWrapper));
    try {
      if (cursor.getSearchBoth(new DatabaseEntry(featureBytesOldIndex), new DatabaseEntry(array), LockMode.DEFAULT) == OperationStatus.SUCCESS) {
        cursor.delete();
      }
    } finally {
      cursor.close();
    }
  } catch (LockConflictException e) {
    throw new BimserverLockConflictException(e);
  } catch (DatabaseException e) {
    LOGGER.error("", e);
  } catch (UnsupportedOperationException e) {
    LOGGER.error("", e);
  } catch (IllegalArgumentException e) {
    LOGGER.error("", e);
  } catch (BimserverDatabaseException e) {
    LOGGER.error("", e);
  }
}

代码示例来源:origin: HuygensING/timbuctoo

initializer = dbCursor -> dbCursor.getSearchBoth(keyEntry, valueEntry, LockMode.DEFAULT);
check = () -> OperationStatus.SUCCESS;

代码示例来源:origin: com.sleepycat/je

lastData = new DatabaseEntry();
} else {
  cursor.getSearchBoth(lastKey, lastData, null);

代码示例来源:origin: HuygensING/timbuctoo

public boolean delete(KeyT key, ValueT value) throws DatabaseWriteException {
 boolean wasChange = false;
 synchronized (keyEntry) {
  try (Cursor cursor = database.openCursor(transaction, CursorConfig.DEFAULT)) {
   keyBinder.objectToEntry(key, keyEntry);
   valueBinder.objectToEntry(value, valueEntry);
   OperationStatus searchResult = cursor.getSearchBoth(keyEntry, valueEntry, LockMode.DEFAULT);
   if (searchResult.equals(OperationStatus.SUCCESS)) {
    wasChange = cursor.delete() == OperationStatus.SUCCESS;
   }
  } catch (Exception e) {
   throw new DatabaseWriteException(e);
  }
 }
 return wasChange;
}

代码示例来源:origin: com.sleepycat/je

private static HashSet<Record> getDiffArea(Cursor cursor,
                      byte[] beginKey,
                      byte[] beginData,
                      long diffSize)
  throws Exception {
  HashSet<Record> records = new HashSet<Record>();
  LogManager logManager = DbInternal.getNonNullEnvImpl
    (cursor.getDatabase().getEnvironment()).getLogManager();
  DatabaseEntry key = new DatabaseEntry(beginKey);
  DatabaseEntry data = new DatabaseEntry(beginData);
  boolean scanToEnd = (diffSize == DATABASE_END ? true : false);
  long count = 1;
  for (OperationStatus status =
     cursor.getSearchBoth(key, data, LockMode.DEFAULT);
     status == OperationStatus.SUCCESS;
     status = cursor.getNext(key, data, LockMode.DEFAULT)) {
    if (!scanToEnd && count > diffSize) {
      break;
    }
    records.add(new Record(key.getData(), data.getData(),
                getVLSN(cursor, logManager)));
    count++;
  }
  return records;
}

代码示例来源:origin: net.sourceforge.ondex.core/berkeley

OperationStatus retVal = cursor.getSearchBoth(theKey, theData,
    LockMode.DEFAULT);

代码示例来源:origin: net.sourceforge.ondex.core/berkeley

final OperationStatus myRetVal = containsCursor.getSearchBoth(
    theKey, myData, LockMode.DEFAULT);

相关文章