本文整理了Java中com.sleepycat.je.Cursor.getPrev()
方法的一些代码示例,展示了Cursor.getPrev()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cursor.getPrev()
方法的具体详情如下:
包路径:com.sleepycat.je.Cursor
类名称:Cursor
方法名:getPrev
[英]Moves the cursor to the previous key/data pair and returns that pair.
Calling this method is equivalent to calling #get(DatabaseEntry,DatabaseEntry,Get,ReadOptions) with Get#PREV.
If the cursor is not yet initialized, move the cursor to the last key/data pair of the database, and return that pair. Otherwise, the cursor is moved to the previous key/data pair of the database, and that pair is returned. In the presence of duplicate key values, the value of the key may not change.
[中]将光标移动到上一个键/数据对并返回该对。
调用此方法相当于使用get#PREV调用#get(DatabaseEntry,DatabaseEntry,get,ReadOptions)。
如果光标尚未初始化,请将光标移动到数据库的最后一个键/数据对,然后返回该对。否则,光标将移动到数据库的上一个键/数据对,并返回该对。存在重复的键值时,键值可能不会更改。
代码示例来源:origin: com.amazon.carbonado/carbonado-sleepycat-je
@Override
protected boolean cursor_getPrev() throws Exception {
return cursor().getPrev(mSearchKey, mData, mLockMode) == SUCCESS;
}
代码示例来源:origin: HuygensING/timbuctoo
} else {
iterator = dbCursor -> {
final OperationStatus result = dbCursor.getPrev(keyEntry, valueEntry, LockMode.DEFAULT);
return result == OperationStatus.SUCCESS ? check.get() : result;
};
final OperationStatus result;
if (dbCursor.getNextNoDup(keyEntry, valueEntry, LockMode.DEFAULT) == OperationStatus.SUCCESS) {
result = dbCursor.getPrev(keyEntry, valueEntry, LockMode.DEFAULT);
} else {
代码示例来源:origin: iipc/openwayback
private void initialize(Cursor cursor,String search, boolean backward)
throws DatabaseException {
this.cursor = cursor;
this.backward = backward;
key = new DatabaseEntry();
value = new DatabaseEntry();
key.setData(search.getBytes());
key.setPartial(false);
OperationStatus status = cursor.getSearchKeyRange(key, value,
LockMode.DEFAULT);
if(backward && (status == OperationStatus.SUCCESS)) {
// if we are in reverse, immediately back up one record:
status = cursor.getPrev(key, value, LockMode.DEFAULT);
}
if(status == OperationStatus.SUCCESS) {
gotNext = true;
}
record = new BDBRecord(key,value);
}
代码示例来源:origin: org.netpreserve.openwayback/openwayback-core
private void initialize(Cursor cursor,String search, boolean backward)
throws DatabaseException {
this.cursor = cursor;
this.backward = backward;
key = new DatabaseEntry();
value = new DatabaseEntry();
key.setData(search.getBytes());
key.setPartial(false);
OperationStatus status = cursor.getSearchKeyRange(key, value,
LockMode.DEFAULT);
if(backward && (status == OperationStatus.SUCCESS)) {
// if we are in reverse, immediately back up one record:
status = cursor.getPrev(key, value, LockMode.DEFAULT);
}
if(status == OperationStatus.SUCCESS) {
gotNext = true;
}
record = new BDBRecord(key,value);
}
代码示例来源:origin: iipc/openwayback
public boolean hasNext() {
if(hitLast) {
return false;
}
if(cursor == null) {
return false;
}
if(!gotNext) {
OperationStatus status;
// attempt to get the next:
try {
if(backward) {
status = cursor.getPrev(key, value, LockMode.DEFAULT);
} else {
status = cursor.getNext(key, value, LockMode.DEFAULT);
}
if(status == OperationStatus.SUCCESS) {
gotNext = true;
} else {
close();
}
} catch (DatabaseException e) {
// SLOP: throw a runtime?
e.printStackTrace();
close();
}
}
return gotNext;
}
代码示例来源:origin: org.netpreserve.openwayback/openwayback-core
public boolean hasNext() {
if(hitLast) {
return false;
}
if(cursor == null) {
return false;
}
if(!gotNext) {
OperationStatus status;
// attempt to get the next:
try {
if(backward) {
status = cursor.getPrev(key, value, LockMode.DEFAULT);
} else {
status = cursor.getNext(key, value, LockMode.DEFAULT);
}
if(status == OperationStatus.SUCCESS) {
gotNext = true;
} else {
close();
}
} catch (DatabaseException e) {
// SLOP: throw a runtime?
e.printStackTrace();
close();
}
}
return gotNext;
}
代码示例来源:origin: addthis/hydra
status = cursor.getPrev(dk, dvs, lockMode);
if (log.isDebugEnabled()) log.debug("<-- prev -- " + status);
代码示例来源:origin: addthis/hydra
status = cursor.getPrev(dk, dvs, lockMode);
代码示例来源:origin: addthis/hydra
status = cursor.getPrev(dk, dvs, lockMode);
代码示例来源:origin: addthis/hydra
status = cursor.getPrev(dk, dvs, lockMode);
代码示例来源:origin: addthis/hydra
status = cursor.getPrev(dk, dvs, lockMode);
代码示例来源:origin: addthis/hydra
/**
* internal/raw bdb delete
*/
@Override public byte[] delete(byte[] key) throws DatabaseException {
DatabaseEntry dk = new DatabaseEntry(key);
DatabaseEntry dv = new DatabaseEntry();
dv.setPartial(0, 0, true);
Cursor cursor = bdb.openCursor(null, CursorConfig.READ_UNCOMMITTED);
try {
if (cursor.getSearchKey(dk, dv, lockMode) == opSuccess && cursor.delete() == opSuccess && cursor.getPrev(dk, dv, lockMode) == opSuccess) {
return dk.getData();
}
} finally {
cursor.close();
}
return null;
}
代码示例来源:origin: addthis/hydra
/**
* internal/raw bdb delete
*/
@Override public byte[] delete(byte[] key) throws DatabaseException {
DatabaseEntry dk = new DatabaseEntry(key);
DatabaseEntry dv = new DatabaseEntry();
dv.setPartial(0, 0, true);
Cursor cursor = bdb.openCursor(null, cursorConfig);
try {
if (cursor.getSearchKey(dk, dv, lockMode) == opSuccess &&
cursor.delete() == opSuccess && cursor.getPrev(dk, dv, lockMode) == opSuccess) {
return dk.getData();
}
} finally {
cursor.close();
}
return null;
}
代码示例来源:origin: org.jsimpledb/jsimpledb-kv-bdb
try {
final OperationStatus status = this.reverse ?
this.cursor.getPrev(key, value, null) : this.cursor.getNext(key, value, null);
switch (status) {
case SUCCESS:
代码示例来源:origin: com.sleepycat/je
status = cursor.getPrev(key, data, LockMode.DEFAULT);
if (isValidBucket(status, key)) {
return true;
代码示例来源:origin: io.permazen/permazen-kv-bdb
try {
final OperationStatus status = this.reverse ?
this.cursor.getPrev(key, value, null) : this.cursor.getNext(key, value, null);
switch (status) {
case SUCCESS:
代码示例来源:origin: com.sleepycat/je
status = cursor.getPrev(key, data, LockMode.DEFAULT);
if (isValidBucket(status, key)) {
VLSNBucket prevBucket = VLSNBucket.readFromDatabase(data);
代码示例来源:origin: com.sleepycat/je
status = cursor.getPrev(key, data, LockMode.DEFAULT);
assert status == OperationStatus.SUCCESS;
代码示例来源:origin: com.sleepycat/je
deleteEnd);
} while (cursor.getPrev(key, noData, LockMode.DEFAULT) ==
OperationStatus.SUCCESS);
内容来源于网络,如有侵权,请联系作者删除!