com.sleepycat.je
Class Cursor

java.lang.Object
  extended by com.sleepycat.je.Cursor
Direct Known Subclasses:
SecondaryCursor

public class Cursor
extends Object

Javadoc for this public class is generated via the doc templates in the doc_src directory.


Field Summary
(package private)  CursorConfig config
          The CursorConfig used to configure this cursor.
(package private)  CursorImpl cursorImpl
          The underlying cursor.
 
Constructor Summary
Cursor(Cursor cursor, boolean samePosition)
          Copy constructor.
Cursor(DatabaseImpl dbImpl, Locker locker, CursorConfig cursorConfig)
          Creates a cursor for a given locker and no db handle.
Cursor(Database dbHandle, Locker locker, CursorConfig cursorConfig)
          Creates a cursor for a given locker.
Cursor(Database dbHandle, Transaction txn, CursorConfig cursorConfig)
          Creates a cursor for a given user transaction.
 
Method Summary
(package private)  boolean advanceCursor(DatabaseEntry key, DatabaseEntry data)
           
(package private)  void checkEnv()
           
(package private)  void checkState(boolean mustBeInitialized)
          Check the environment and cursor state.
protected  void checkUpdatesAllowed(String operation)
           
 void close()
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 int count()
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
(package private)  int countInternal()
          Counts duplicates without parameter checking.
 OperationStatus delete()
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
(package private)  OperationStatus deleteInternal()
          Internal version of delete() that does no parameter checking.
(package private)  OperationStatus deleteNoNotify()
          Clone the cursor, delete at current position, and if successful, swap cursors.
 Cursor dup(boolean samePosition)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 CursorConfig getConfig()
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus getCurrent(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
(package private)  OperationStatus getCurrentInternal(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Returns the current key and data.
(package private)  CursorImpl getCursorImpl()
          Internal entrypoint.
 Database getDatabase()
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
(package private)  DatabaseImpl getDatabaseImpl()
          Always returns non-null, while getDatabase() returns null if no handle is associated with this cursor.
 OperationStatus getFirst(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus getLast(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus getNext(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus getNextDup(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus getNextNoDup(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus getPrev(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus getPrevDup(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus getPrevNoDup(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus getSearchBoth(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus getSearchBothRange(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus getSearchKey(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus getSearchKeyRange(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
(package private)  boolean isReadUncommittedMode(LockMode lockMode)
          Returns whether the given lock mode will cause a read-uncommitted when used with this cursor, taking into account the default cursor configuration.
(package private)  OperationStatus position(DatabaseEntry key, DatabaseEntry data, LockMode lockMode, boolean first)
          Position the cursor at the first or last record of the database.
 OperationStatus put(DatabaseEntry key, DatabaseEntry data)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
 OperationStatus putCurrent(DatabaseEntry data)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
(package private)  OperationStatus putInternal(DatabaseEntry key, DatabaseEntry data, PutMode putMode)
          Internal version of put() that does no parameter checking.
 OperationStatus putNoDupData(DatabaseEntry key, DatabaseEntry data)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
(package private)  OperationStatus putNoNotify(DatabaseEntry key, DatabaseEntry data, PutMode putMode, DatabaseEntry returnOldData)
          Performs the put operation but does not notify triggers (does not perform secondary updates).
 OperationStatus putNoOverwrite(DatabaseEntry key, DatabaseEntry data)
          Javadoc for this public method is generated via the doc templates in the doc_src directory.
(package private)  OperationStatus retrieveNext(DatabaseEntry key, DatabaseEntry data, LockMode lockMode, GetMode getMode)
          Retrieve the next or previous record.
(package private)  OperationStatus search(DatabaseEntry key, DatabaseEntry data, LockMode lockMode, CursorImpl.SearchMode searchMode)
          Perform search by key, data, or both.
(package private)  void trace(Level level, String methodName, DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
          Send trace messages to the java.util.logger.
(package private)  void trace(Level level, String methodName, LockMode lockMode)
          Send trace messages to the java.util.logger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cursorImpl

CursorImpl cursorImpl
The underlying cursor.


config

CursorConfig config
The CursorConfig used to configure this cursor.

Constructor Detail

Cursor

Cursor(Database dbHandle,
       Transaction txn,
       CursorConfig cursorConfig)
 throws DatabaseException
Creates a cursor for a given user transaction.

If txn is null, a non-transactional cursor will be created that releases locks for the prior operation when the next operation suceeds.

Throws:
DatabaseException

Cursor

Cursor(Database dbHandle,
       Locker locker,
       CursorConfig cursorConfig)
 throws DatabaseException
Creates a cursor for a given locker.

If locker is null or is non-transactional, a non-transactional cursor will be created that releases locks for the prior operation when the next operation suceeds.

Throws:
DatabaseException

Cursor

Cursor(DatabaseImpl dbImpl,
       Locker locker,
       CursorConfig cursorConfig)
 throws DatabaseException
Creates a cursor for a given locker and no db handle.

The locker parameter must be non-null. With this constructor, we use the given locker without applying any special rules for different isolation levels -- the caller must supply the correct locker.

Throws:
DatabaseException

Cursor

Cursor(Cursor cursor,
       boolean samePosition)
 throws DatabaseException
Copy constructor.

Throws:
DatabaseException
Method Detail

getCursorImpl

CursorImpl getCursorImpl()
Internal entrypoint.


getDatabase

public Database getDatabase()
Javadoc for this public method is generated via the doc templates in the doc_src directory.


getDatabaseImpl

DatabaseImpl getDatabaseImpl()
Always returns non-null, while getDatabase() returns null if no handle is associated with this cursor.


getConfig

public CursorConfig getConfig()
Javadoc for this public method is generated via the doc templates in the doc_src directory.


close

public void close()
           throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

count

public int count()
          throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

dup

public Cursor dup(boolean samePosition)
           throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

delete

public OperationStatus delete()
                       throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

put

public OperationStatus put(DatabaseEntry key,
                           DatabaseEntry data)
                    throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

putNoOverwrite

public OperationStatus putNoOverwrite(DatabaseEntry key,
                                      DatabaseEntry data)
                               throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

putNoDupData

public OperationStatus putNoDupData(DatabaseEntry key,
                                    DatabaseEntry data)
                             throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

putCurrent

public OperationStatus putCurrent(DatabaseEntry data)
                           throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getCurrent

public OperationStatus getCurrent(DatabaseEntry key,
                                  DatabaseEntry data,
                                  LockMode lockMode)
                           throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getFirst

public OperationStatus getFirst(DatabaseEntry key,
                                DatabaseEntry data,
                                LockMode lockMode)
                         throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getLast

public OperationStatus getLast(DatabaseEntry key,
                               DatabaseEntry data,
                               LockMode lockMode)
                        throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getNext

public OperationStatus getNext(DatabaseEntry key,
                               DatabaseEntry data,
                               LockMode lockMode)
                        throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getNextDup

public OperationStatus getNextDup(DatabaseEntry key,
                                  DatabaseEntry data,
                                  LockMode lockMode)
                           throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getNextNoDup

public OperationStatus getNextNoDup(DatabaseEntry key,
                                    DatabaseEntry data,
                                    LockMode lockMode)
                             throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getPrev

public OperationStatus getPrev(DatabaseEntry key,
                               DatabaseEntry data,
                               LockMode lockMode)
                        throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getPrevDup

public OperationStatus getPrevDup(DatabaseEntry key,
                                  DatabaseEntry data,
                                  LockMode lockMode)
                           throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getPrevNoDup

public OperationStatus getPrevNoDup(DatabaseEntry key,
                                    DatabaseEntry data,
                                    LockMode lockMode)
                             throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getSearchKey

public OperationStatus getSearchKey(DatabaseEntry key,
                                    DatabaseEntry data,
                                    LockMode lockMode)
                             throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getSearchKeyRange

public OperationStatus getSearchKeyRange(DatabaseEntry key,
                                         DatabaseEntry data,
                                         LockMode lockMode)
                                  throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getSearchBoth

public OperationStatus getSearchBoth(DatabaseEntry key,
                                     DatabaseEntry data,
                                     LockMode lockMode)
                              throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

getSearchBothRange

public OperationStatus getSearchBothRange(DatabaseEntry key,
                                          DatabaseEntry data,
                                          LockMode lockMode)
                                   throws DatabaseException
Javadoc for this public method is generated via the doc templates in the doc_src directory.

Throws:
DatabaseException

countInternal

int countInternal()
            throws DatabaseException
Counts duplicates without parameter checking.

Throws:
DatabaseException

deleteInternal

OperationStatus deleteInternal()
                         throws DatabaseException
Internal version of delete() that does no parameter checking. Calls deleteNoNotify() and notifies triggers (performs secondary updates).

Throws:
DatabaseException

deleteNoNotify

OperationStatus deleteNoNotify()
                         throws DatabaseException
Clone the cursor, delete at current position, and if successful, swap cursors. Does not notify triggers (does not perform secondary updates).

Throws:
DatabaseException

putInternal

OperationStatus putInternal(DatabaseEntry key,
                            DatabaseEntry data,
                            PutMode putMode)
                      throws DatabaseException
Internal version of put() that does no parameter checking. Calls putNoNotify() and notifies triggers (performs secondary updates). Prevents phantoms.

Throws:
DatabaseException

putNoNotify

OperationStatus putNoNotify(DatabaseEntry key,
                            DatabaseEntry data,
                            PutMode putMode,
                            DatabaseEntry returnOldData)
                      throws DatabaseException
Performs the put operation but does not notify triggers (does not perform secondary updates). Prevents phantoms.

Throws:
DatabaseException

position

OperationStatus position(DatabaseEntry key,
                         DatabaseEntry data,
                         LockMode lockMode,
                         boolean first)
                   throws DatabaseException
Position the cursor at the first or last record of the database. Prevents phantoms.

Throws:
DatabaseException

search

OperationStatus search(DatabaseEntry key,
                       DatabaseEntry data,
                       LockMode lockMode,
                       CursorImpl.SearchMode searchMode)
                 throws DatabaseException
Perform search by key, data, or both. Prevents phantoms.

Throws:
DatabaseException

retrieveNext

OperationStatus retrieveNext(DatabaseEntry key,
                             DatabaseEntry data,
                             LockMode lockMode,
                             GetMode getMode)
                       throws DatabaseException
Retrieve the next or previous record. Prevents phantoms.

Throws:
DatabaseException

getCurrentInternal

OperationStatus getCurrentInternal(DatabaseEntry key,
                                   DatabaseEntry data,
                                   LockMode lockMode)
                             throws DatabaseException
Returns the current key and data. There is no need to prevent phantoms.

Throws:
DatabaseException

advanceCursor

boolean advanceCursor(DatabaseEntry key,
                      DatabaseEntry data)

isReadUncommittedMode

boolean isReadUncommittedMode(LockMode lockMode)
Returns whether the given lock mode will cause a read-uncommitted when used with this cursor, taking into account the default cursor configuration.


checkUpdatesAllowed

protected void checkUpdatesAllowed(String operation)
                            throws DatabaseException
Throws:
DatabaseException

checkState

void checkState(boolean mustBeInitialized)
          throws DatabaseException
Check the environment and cursor state.

Throws:
DatabaseException

checkEnv

void checkEnv()
        throws RunRecoveryException
Throws:
RunRecoveryException - if the underlying environment is invalid.

trace

void trace(Level level,
           String methodName,
           DatabaseEntry key,
           DatabaseEntry data,
           LockMode lockMode)
Send trace messages to the java.util.logger. Don't rely on the logger alone to conditionalize whether we send this message, we don't even want to construct the message if the level is not enabled.


trace

void trace(Level level,
           String methodName,
           LockMode lockMode)
Send trace messages to the java.util.logger. Don't rely on the logger alone to conditionalize whether we send this message, we don't even want to construct the message if the level is not enabled.



Copyright 2004-2005 Sleepycat, Inc. All Rights Reserved.