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

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

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

Cursor.getLast介绍

[英]Moves the cursor to the last key/data pair of the database, and returns that pair. If the last key has duplicate values, the last data item in the set of duplicates is returned.

Calling this method is equivalent to calling #get(DatabaseEntry,DatabaseEntry,Get,ReadOptions) with Get#LAST.
[中]将光标移动到数据库的最后一个键/数据对,并返回该对。如果最后一个键具有重复值,则返回重复集合中的最后一个数据项。
调用此方法相当于使用get#LAST调用#get(DatabaseEntry,DatabaseEntry,get,ReadOptions)。

代码示例

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

@Override
  public Record last() throws BimserverLockConflictException {
    DatabaseEntry key = new DatabaseEntry();
    DatabaseEntry value = new DatabaseEntry();
    try {
      OperationStatus next = cursor.getLast(key, value, LockMode.DEFAULT);
      if (next == OperationStatus.SUCCESS) {
        return new BerkeleyRecord(key, value);
      } else {
        return null;
      }
    } catch (DatabaseException e) {
    }
    return null;
  }
}

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

@Override
  public Record last() throws BimserverLockConflictException {
    if (nextStartSearchingAt != null) {
      return getFirstNext(nextStartSearchingAt);
    }
    DatabaseEntry key = new DatabaseEntry();
    DatabaseEntry value = new DatabaseEntry();
    if (onlyKeys) {
      value.setPartial(0, 0, true);
    }
    try {
      OperationStatus next = cursor.getLast(key, value, LockMode.DEFAULT);
      if (next == OperationStatus.SUCCESS) {
        byte[] firstBytes = new byte[mustStartWith.length];
        System.arraycopy(key.getData(), 0, firstBytes, 0, mustStartWith.length);
        if (Arrays.equals(firstBytes, mustStartWith)) {
          return new BerkeleyRecord(key, value);
        }
      }
    } catch (LockConflictException e) {
      throw new BimserverLockConflictException(e);
    } catch (DatabaseException e) {
      LOGGER.error("", e);
    }
    return null;
  }
}

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

@Override
protected boolean cursor_getLast() throws Exception {
  return cursor().getLast(mSearchKey, mData, mLockMode) == SUCCESS;
}

代码示例来源:origin: com.projectdarkstar.server/sgs-server

/** {@inheritDoc} */
public boolean findLast() {
try {
  OperationStatus status =
  cursor.getLast(keyEntry, valueEntry, null);
  if (status == SUCCESS) {
  isCurrent = true;
  return true;
  } else if (status == NOTFOUND) {
  return false;
  } else {
  throw new DbDatabaseException("Operation failed: " + status);
  }
} catch (DatabaseException e) {
  throw JeEnvironment.convertException(e, true);
}
}

代码示例来源:origin: org.reddwarfserver.server/sgs-server

/** {@inheritDoc} */
public boolean findLast() {
try {
  OperationStatus status =
  cursor.getLast(keyEntry, valueEntry, null);
  if (status == SUCCESS) {
  isCurrent = true;
  return true;
  } else if (status == NOTFOUND) {
  return false;
  } else {
  throw new DbDatabaseException("Operation failed: " + status);
  }
} catch (DatabaseException e) {
  throw JeEnvironment.convertException(e, true);
}
}

代码示例来源:origin: dworkin/reddwarf

/** {@inheritDoc} */
public boolean findLast() {
try {
  OperationStatus status =
  cursor.getLast(keyEntry, valueEntry, null);
  if (status == SUCCESS) {
  isCurrent = true;
  return true;
  } else if (status == NOTFOUND) {
  return false;
  } else {
  throw new DbDatabaseException("Operation failed: " + status);
  }
} catch (DatabaseException e) {
  throw JeEnvironment.convertException(e, true);
}
}

代码示例来源:origin: co.paralleluniverse/galaxy

private long getMaxId(Database db) {
  final DatabaseEntry key = new DatabaseEntry();
  final DatabaseEntry value = new DatabaseEntry();
  try (Cursor cursor = db.openCursor(null, CursorConfig.DEFAULT)) {
    final OperationStatus status = cursor.getLast(key, value, null);
    if (status == OperationStatus.SUCCESS)
      return Longs.fromByteArray(key.getData());
    else
      return 0;
  }
}

代码示例来源:origin: addthis/hydra

@Override
public byte[] lastKey() {
  Cursor c = bdb.openCursor(null, cursorConfig);
  try {
    DatabaseEntry dk = new DatabaseEntry();
    if (c.getLast(dk, new DatabaseEntry(), lockMode) == opSuccess) {
      return dk.getData();
    }
    return null;
  } finally {
    c.close();
  }
}

代码示例来源:origin: addthis/hydra

@Override
public byte[] lastKey() {
  Cursor c = bdb.openCursor(null, CursorConfig.READ_UNCOMMITTED);
  try {
    DatabaseEntry dk = new DatabaseEntry();
    if (c.getLast(dk, new DatabaseEntry(), lockMode) == opSuccess) {
      return dk.getData();
    }
    return null;
  } finally {
    c.close();
  }
}

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

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

代码示例来源:origin: addthis/hydra

status = cursor.getLast(dk, dvs, lockMode);
if (log.isDebugEnabled()) {
  log.debug("--> floor --> tolast key=" + LessBytes.toString(

代码示例来源:origin: addthis/hydra

status = cursor.getLast(dk, dvs, lockMode);

代码示例来源:origin: addthis/hydra

status = cursor.getLast(dk, dvs, lockMode);

代码示例来源:origin: addthis/hydra

status = cursor.getLast(dk, dvs, lockMode);

代码示例来源:origin: addthis/hydra

status = cursor.getLast(dk, dvs, lockMode);

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

status =  cursor.getLast(key, data, LockMode.DEFAULT);
if (isValidBucket(status, key)) {
  return true;

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

} else {
 result = dbCursor.getLast(keyEntry, valueEntry, LockMode.DEFAULT);

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

DatabaseEntry key = new DatabaseEntry();
DatabaseEntry data = new DatabaseEntry();
OperationStatus status = cursor.getLast(key, data,
                    LockMode.DEFAULT);
if (isValidBucket(status, key)) {

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

status =  cursor.getLast(key, data, LockMode.DEFAULT);
if (isValidBucket(status, key)) {
  bucket = VLSNBucket.readFromDatabase(data);

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

OperationStatus status = cursor.getLast(key, data,
                    LockMode.DEFAULT);

相关文章