00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 package com.sleepycat.db;
00011
00012 import com.sleepycat.db.internal.DbConstants;
00013 import com.sleepycat.db.internal.Dbc;
00014
00015 public class JoinCursor {
00016 private Database database;
00017 private Dbc dbc;
00018 private JoinConfig config;
00019
00020 JoinCursor(final Database database,
00021 final Dbc dbc,
00022 final JoinConfig config) {
00023 this.database = database;
00024 this.dbc = dbc;
00025 this.config = config;
00026 }
00027
00028 public void close()
00029 throws DatabaseException {
00030
00031 dbc.close();
00032 }
00033
00034 public Database getDatabase() {
00035 return database;
00036 }
00037
00038 public JoinConfig getConfig() {
00039 return config;
00040 }
00041
00042 public OperationStatus getNext(final DatabaseEntry key, LockMode lockMode)
00043 throws DatabaseException {
00044
00045 return OperationStatus.fromInt(
00046 dbc.get(key, DatabaseEntry.IGNORE,
00047 DbConstants.DB_JOIN_ITEM |
00048 LockMode.getFlag(lockMode)));
00049 }
00050
00051 public OperationStatus getNext(final DatabaseEntry key,
00052 final DatabaseEntry data,
00053 LockMode lockMode)
00054 throws DatabaseException {
00055
00056 return OperationStatus.fromInt(
00057 dbc.get(key, data, LockMode.getFlag(lockMode) |
00058 ((data == null) ? 0 : data.getMultiFlag())));
00059 }
00060 }