|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DbCursor
The interface to a cursor for iterating over the contents of a database. A
newly created cursor has no current key or value. Cursors are associated
with a single transaction, and must be created and closed within that single
transaction. Cursors must not be used after the close method
is called. Cursor implementations are not required to be synchronized.
| Method Summary | |
|---|---|
void |
close()
Closes this cursor, releasing any associated resources. |
boolean |
findFirst()
Searches for the first key in the database. |
boolean |
findLast()
Searches for the last key in the database. |
boolean |
findNext()
Searches for the next key in the database. |
boolean |
findNext(byte[] key)
Searches for the first key that is greater than or equal to the specified key. |
byte[] |
getKey()
Returns the current key, or null if the cursor has no current
key. |
byte[] |
getValue()
Returns the current value, or null if the cursor has no current
value. |
boolean |
putNoOverwrite(byte[] key,
byte[] value)
Uses the cursor to set the value associated with a key in the database, if the key does not already have an associated value. |
| Method Detail |
|---|
byte[] getKey()
null if the cursor has no current
key.
null
TransactionAbortedException - if the transaction should be
aborted due to timeout or conflict
DbDatabaseException - if an unexpected database problem occursbyte[] getValue()
null if the cursor has no current
value.
null
TransactionAbortedException - if the transaction should be
aborted due to timeout or conflict
DbDatabaseException - if an unexpected database problem occursboolean findFirst()
true, then sets the current key and value to the first key and its
associated value.
true if the first key was found, else false
TransactionAbortedException - if the transaction should be
aborted due to timeout or conflict
DbDatabaseException - if an unexpected database problem occursboolean findNext()
true,
then sets the current key and value to the key found and its associated
value.
true if the next key was found, else false
TransactionAbortedException - if the transaction should be
aborted due to timeout or conflict
DbDatabaseException - if an unexpected database problem occursboolean findNext(byte[] key)
true, then sets the current key
and value to the key found and its associated value.
key - the key at which to start searching
true if the next key was found, else false
TransactionAbortedException - if the transaction should be
aborted due to timeout or conflict
DbDatabaseException - if an unexpected database problem occursboolean findLast()
true, then sets the current key and value to the last key and its
associated value.
true if the last key was found, else false
TransactionAbortedException - if the transaction should be
aborted due to timeout or conflict
DbDatabaseException - if an unexpected database problem occurs
boolean putNoOverwrite(byte[] key,
byte[] value)
true, then sets the current key and value to the newly inserted
key and its associated value.
key - the keyvalue - the value
true if a value was stored for the key, and false if the key already had a value
TransactionAbortedException - if the transaction should be
aborted due to timeout or conflict
DbDatabaseException - if an unexpected database problem occursvoid close()
Note that the Berkeley DB documentation for prepare doesn't say you need to close cursors, but my testing shows that you do. -tjb@sun.com (12/14/2006)
TransactionAbortedException - if the transaction should be
aborted due to timeout or conflict
DbDatabaseException - if an unexpected database problem occurs
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||