本文整理了Java中com.sleepycat.je.Cursor.getNextNoDup()
方法的一些代码示例,展示了Cursor.getNextNoDup()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cursor.getNextNoDup()
方法的具体详情如下:
包路径:com.sleepycat.je.Cursor
类名称:Cursor
方法名:getNextNoDup
[英]Moves the cursor to the next non-duplicate key/data pair and returns that pair. If the matching key has duplicate values, the first data item in the set of duplicates is returned.
Calling this method is equivalent to calling #get(DatabaseEntry,DatabaseEntry,Get,ReadOptions) with Get#NEXT_NO_DUP.
If the cursor is not yet initialized, move the cursor to the first key/data pair of the database, and return that pair. Otherwise, the cursor is moved to the next non-duplicate key of the database, and that key/data pair is returned.
[中]将光标移动到下一个非重复密钥/数据对并返回该对。如果匹配项具有重复值,则返回重复项集中的第一个数据项。
调用此方法相当于使用get#NEXT_NO_DUP调用#get(DatabaseEntry,DatabaseEntry,get,ReadOptions)。
如果光标尚未初始化,请将光标移动到数据库的第一个键/数据对,然后返回该对。否则,光标将移动到数据库的下一个非重复密钥,并返回该密钥/数据对。
代码示例来源:origin: itisaid/Doris
protected boolean moveCursor(DatabaseEntry key, DatabaseEntry value) throws DatabaseException {
return cursor.getNextNoDup(key, value, LockMode.READ_UNCOMMITTED) == OperationStatus.SUCCESS;
}
代码示例来源:origin: org.deephacks/graphene-core
public Map<byte[], byte[]> listAll() {
Map<byte[], byte[]> map = new HashMap<>();
try (Cursor cursor = db.get().openCursor(tm.getInternalTx(), null)) {
DatabaseEntry firstKey = new DatabaseEntry(RowKey.getMinId().getKey());
DatabaseEntry entry = new DatabaseEntry();
if (cursor.getSearchKeyRange(firstKey, entry, LockMode.RMW) == OperationStatus.SUCCESS) {
map.put(firstKey.getData(), entry.getData());
}
while (cursor.getNextNoDup(firstKey, entry, LockMode.RMW) == OperationStatus.SUCCESS) {
map.put(firstKey.getData(), entry.getData());
}
}
return map;
}
代码示例来源:origin: org.deephacks/graphene-core
public void deleteAll() {
try (Cursor cursor = db.get().openCursor(tm.getInternalTx(), null)) {
DatabaseEntry firstKey = new DatabaseEntry(RowKey.getMinId().getKey());
if (cursor.getSearchKeyRange(firstKey, new DatabaseEntry(), LockMode.RMW) == OperationStatus.SUCCESS) {
cursor.delete();
}
while (cursor.getNextNoDup(firstKey, new DatabaseEntry(), LockMode.RMW) == OperationStatus.SUCCESS) {
cursor.delete();
}
}
}
}
代码示例来源:origin: HuygensING/timbuctoo
initialSkip = dbCursor -> {
final OperationStatus result;
if (dbCursor.getNextNoDup(keyEntry, valueEntry, LockMode.DEFAULT) == OperationStatus.SUCCESS) {
result = dbCursor.getPrev(keyEntry, valueEntry, LockMode.DEFAULT);
} else {
代码示例来源:origin: org.deephacks/graphene-core
public void deleteAll(Class<?> entityClass) {
synchronized (WRITE_LOCK) {
try {
try (Cursor cursor = openPrimaryCursor()) {
byte[] firstKey = RowKey.getMinId(entityClass).getKey();
byte[] lastKey = RowKey.getMaxId(entityClass).getKey();
DatabaseEntry keyEntry = new DatabaseEntry(firstKey);
if (cursor.getSearchKeyRange(keyEntry, new DatabaseEntry(), LockMode.RMW) == OperationStatus.SUCCESS) {
// important; we must respect the class prefix boundaries of the key
if (!FastKeyComparator.withinKeyRange(keyEntry.getData(), firstKey, lastKey)) {
return;
}
cursor.delete();
}
while (cursor.getNextNoDup(keyEntry, new DatabaseEntry(), LockMode.RMW) == OperationStatus.SUCCESS) {
// important; we must respect the class prefix boundaries of the key
if (!FastKeyComparator.withinKeyRange(keyEntry.getData(), firstKey, lastKey)) {
return;
}
cursor.delete();
}
}
} catch (DeleteConstraintException e) {
throw new org.deephacks.graphene.DeleteConstraintException(
new RowKey(e.getPrimaryKey().getData()) + " have a reference to " + new RowKey(e.getSecondaryKey().getData()), e);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!