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

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

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

Cursor.count介绍

[英]Returns a count of the number of data items for the key to which the cursor refers.

If the database is configured for duplicates, the database is scanned internally, without taking any record locks, to count the number of non-deleted entries. Although the internal scan is more efficient under some conditions, the result is the same as if a cursor were used to iterate over the entries using LockMode#READ_UNCOMMITTED.

If the database is not configured for duplicates, the count returned is always zero or one, depending on the record at the cursor position is deleted or not.

The cost of this method is directly proportional to the number of records scanned.
[中]返回光标指向的键的数据项数的计数。
如果数据库配置为重复,则会在不使用任何记录锁的情况下对数据库进行内部扫描,以统计未删除条目的数量。尽管在某些情况下,内部扫描效率更高,但结果与使用LockMode#READ#u UNCOMMITTED的游标在条目上进行迭代的结果相同。
如果数据库未配置为重复,则返回的计数始终为零或一,具体取决于光标位置的记录是否被删除。
此方法的成本与扫描的记录数成正比。

代码示例

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

public int count()
  throws DatabaseException {
  return cursor.count();
}

代码示例来源:origin: stackoverflow.com

Cursor c =
       db.query(DATABASE_TABLE, new String[] {
         "_id", "code", "name"}, null, null, null, null, null);
     int numRows = c.count();

代码示例来源:origin: stackoverflow.com

Cursor crr = db.getRecord(4);
  int n = crr.count();
  arr = new int[n];

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

@Override
public int size() {
  Cursor c = berkeley.openSecondaryCursor(proxyObject, null, clazz, cc);
  DatabaseEntry theData = new DatabaseEntry();
  // TODO: this is a very slow but robust way to get the size
  int size = 0;
  OperationStatus retVal = c.getSearchKey(theKey, theData,
      LockMode.DEFAULT);
  if (retVal == OperationStatus.SUCCESS && c.count() > 0) {
    while (retVal == OperationStatus.SUCCESS) {
      retVal = c.getNextDup(theKey, theData, LockMode.DEFAULT);
      size++;
    }
  }
  berkeley.releaseCursor(proxyObject);
  return size;
}

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

&& cursor.count() > 1) {
retVal = cursor.getNextDup(theKey, theData,
    LockMode.DEFAULT);

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

@Override
public int size() {
  if (size == null) {
    CursorConfig cc = new CursorConfig();
    cc.setReadUncommitted(true);
    Cursor c = berkeley.openDupCursor(proxyObject, null, clazz, cc);
    if (c.getSearchKey(theKey, new DatabaseEntry(), LockMode.DEFAULT) != OperationStatus.SUCCESS) {
      size = 0;
    } else {
      size = c.count();
    }
    berkeley.releaseCursor(c);
  }
  return size;
}

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

&& cursor.count() > 0) {
retVal = cursor.getNextDup(theKey, theData,
    LockMode.DEFAULT);

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

theData.getData());
set.set(o.getId());
if (cursor.count() > 1) {
  while (cursor.getNextDup(theKey, theData,
      LockMode.DEFAULT) == OperationStatus.SUCCESS) {

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

LockMode.DEFAULT);
  if (containsCursor.count() > 0) {
if (containsCursor.count() == 0) {
  return false;

相关文章