📄 rangecursor.java
字号:
if (!pkRange.endInclusive || pkRange.compare(pkRange.endKey, privPKey) != 0) { status = doGetPrevDup(lockMode); } } else { KeyRange.copy(range.beginKey, privKey); doLast = true; } } if (doLast) { status = doGetSearchKey(lockMode); if (status == OperationStatus.SUCCESS) { status = doGetNextNoDup(lockMode); if (status == OperationStatus.SUCCESS) { status = doGetPrev(lockMode); } else { status = doGetLast(lockMode); } } } if (status == OperationStatus.SUCCESS && !pkRange.check(privPKey)) { status = OperationStatus.NOTFOUND; } } else if (range.endKey == null) { status = doGetLast(lockMode); } else { KeyRange.copy(range.endKey, privKey); status = doGetSearchKeyRange(lockMode); if (status == OperationStatus.SUCCESS) { if (range.endInclusive && range.compare(range.endKey, privKey) == 0) { /* Skip this step if dups are not configured? */ status = doGetNextNoDup(lockMode); if (status == OperationStatus.SUCCESS) { status = doGetPrev(lockMode); } else { status = doGetLast(lockMode); } } else { status = doGetPrev(lockMode); } } else { status = doGetLast(lockMode); } } if (status == OperationStatus.SUCCESS && !range.checkBegin(privKey, true)) { status = OperationStatus.NOTFOUND; } } finally { endOperation(oldCursor, status, key, pKey, data); } return status; } public OperationStatus getNext(DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode) throws DatabaseException { OperationStatus status; if (!initialized) { return getFirst(key, pKey, data, lockMode); } if (!range.hasBound()) { setParams(key, pKey, data); status = doGetNext(lockMode); endOperation(null, status, null, null, null); return status; } if (pkRange != null) { if (pkRange.endKey == null) { status = doGetNextDup(lockMode); endOperation(null, status, key, pKey, data); } else { status = OperationStatus.NOTFOUND; Cursor oldCursor = beginOperation(); try { status = doGetNextDup(lockMode); if (status == OperationStatus.SUCCESS && !pkRange.checkEnd(privPKey, true)) { status = OperationStatus.NOTFOUND; } } finally { endOperation(oldCursor, status, key, pKey, data); } } } else if (range.singleKey) { status = doGetNextDup(lockMode); endOperation(null, status, key, pKey, data); } else { status = OperationStatus.NOTFOUND; Cursor oldCursor = beginOperation(); try { status = doGetNext(lockMode); if (status == OperationStatus.SUCCESS && !range.check(privKey)) { status = OperationStatus.NOTFOUND; } } finally { endOperation(oldCursor, status, key, pKey, data); } } return status; } public OperationStatus getNextNoDup(DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode) throws DatabaseException { OperationStatus status; if (!initialized) { return getFirst(key, pKey, data, lockMode); } if (!range.hasBound()) { setParams(key, pKey, data); status = doGetNextNoDup(lockMode); endOperation(null, status, null, null, null); return status; } if (range.singleKey) { status = OperationStatus.NOTFOUND; } else { status = OperationStatus.NOTFOUND; Cursor oldCursor = beginOperation(); try { status = doGetNextNoDup(lockMode); if (status == OperationStatus.SUCCESS && !range.check(privKey)) { status = OperationStatus.NOTFOUND; } } finally { endOperation(oldCursor, status, key, pKey, data); } } return status; } public OperationStatus getPrev(DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode) throws DatabaseException { OperationStatus status; if (!initialized) { return getLast(key, pKey, data, lockMode); } if (!range.hasBound()) { setParams(key, pKey, data); status = doGetPrev(lockMode); endOperation(null, status, null, null, null); return status; } if (pkRange != null) { if (pkRange.beginKey == null) { status = doGetPrevDup(lockMode); endOperation(null, status, key, pKey, data); } else { status = OperationStatus.NOTFOUND; Cursor oldCursor = beginOperation(); try { status = doGetPrevDup(lockMode); if (status == OperationStatus.SUCCESS && !pkRange.checkBegin(privPKey, true)) { status = OperationStatus.NOTFOUND; } } finally { endOperation(oldCursor, status, key, pKey, data); } } } else if (range.singleKey) { status = doGetPrevDup(lockMode); endOperation(null, status, key, pKey, data); } else { status = OperationStatus.NOTFOUND; Cursor oldCursor = beginOperation(); try { status = doGetPrev(lockMode); if (status == OperationStatus.SUCCESS && !range.check(privKey)) { status = OperationStatus.NOTFOUND; } } finally { endOperation(oldCursor, status, key, pKey, data); } } return status; } public OperationStatus getPrevNoDup(DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode) throws DatabaseException { OperationStatus status; if (!initialized) { return getLast(key, pKey, data, lockMode); } if (!range.hasBound()) { setParams(key, pKey, data); status = doGetPrevNoDup(lockMode); endOperation(null, status, null, null, null); return status; } if (range.singleKey) { status = OperationStatus.NOTFOUND; } else { status = OperationStatus.NOTFOUND; Cursor oldCursor = beginOperation(); try { status = doGetPrevNoDup(lockMode); if (status == OperationStatus.SUCCESS && !range.check(privKey)) { status = OperationStatus.NOTFOUND; } } finally { endOperation(oldCursor, status, key, pKey, data); } } return status; } public OperationStatus getSearchKey(DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode) throws DatabaseException { OperationStatus status; if (!range.hasBound()) { setParams(key, pKey, data); status = doGetSearchKey(lockMode); endOperation(null, status, null, null, null); return status; } if (!range.check(key)) { status = OperationStatus.NOTFOUND; } else if (pkRange != null) { status = OperationStatus.NOTFOUND; Cursor oldCursor = beginOperation(); try { shareData(key, privKey); status = doGetSearchKey(lockMode); if (status == OperationStatus.SUCCESS && !pkRange.check(privPKey)) { status = OperationStatus.NOTFOUND; } } finally { endOperation(oldCursor, status, key, pKey, data); } } else { shareData(key, privKey); status = doGetSearchKey(lockMode); endOperation(null, status, key, pKey, data); } return status; } public OperationStatus getSearchBoth(DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode) throws DatabaseException { OperationStatus status; if (!range.hasBound()) { setParams(key, pKey, data); status = doGetSearchBoth(lockMode); endOperation(null, status, null, null, null); return status; } if (!range.check(key) || (pkRange != null && !pkRange.check(pKey))) { status = OperationStatus.NOTFOUND; } else { shareData(key, privKey); if (secCursor != null) { shareData(pKey, privPKey); } else { shareData(data, privData); } status = doGetSearchBoth(lockMode); endOperation(null, status, key, pKey, data); } return status; } public OperationStatus getSearchKeyRange(DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode) throws DatabaseException { OperationStatus status = OperationStatus.NOTFOUND; if (!range.hasBound()) { setParams(key, pKey, data); status = doGetSearchKeyRange(lockMode); endOperation(null, status, null, null, null); return status; } Cursor oldCursor = beginOperation(); try { shareData(key, privKey); status = doGetSearchKeyRange(lockMode); if (status == OperationStatus.SUCCESS && (!range.check(privKey) || (pkRange != null && !pkRange.check(pKey)))) { status = OperationStatus.NOTFOUND; } } finally { endOperation(oldCursor, status, key, pKey, data); } return status; } public OperationStatus getSearchBothRange(DatabaseEntry key, DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode) throws DatabaseException { OperationStatus status = OperationStatus.NOTFOUND; if (!range.hasBound()) { setParams(key, pKey, data); status = doGetSearchBothRange(lockMode); endOperation(null, status, null, null, null); return status; } Cursor oldCursor = beginOperation(); try { shareData(key, privKey); if (secCursor != null) { shareData(pKey, privPKey); } else { shareData(data, privData); } status = doGetSearchBothRange(lockMode); if (status == OperationStatus.SUCCESS && (!range.check(privKey) || (pkRange != null && !pkRange.check(pKey)))) { status = OperationStatus.NOTFOUND; } } finally { endOperation(oldCursor, status, key, pKey, data); } return status; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -